]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_main.c
made darkplaces compile successfully with g++ to test for errors C doesn't care about...
[xonotic/darkplaces.git] / sv_main.c
index 0f798ad88f3ebf45539420fb21aea1bd713ab257..7935327ff6fa65d41405112a16b1b62ba9289319 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -72,6 +72,7 @@ void SV_Init (void)
        Cvar_RegisterVariable (&sv_edgefriction);
        Cvar_RegisterVariable (&sv_stopspeed);
        Cvar_RegisterVariable (&sv_maxspeed);
+       Cvar_RegisterVariable (&sv_maxairspeed);
        Cvar_RegisterVariable (&sv_accelerate);
        Cvar_RegisterVariable (&sv_idealpitchscale);
        Cvar_RegisterVariable (&sv_aim);
@@ -905,7 +906,7 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t
        // stuff the sigil bits into the high bits of items for sbar, or else
        // mix in items2
        val = PRVM_GETEDICTFIELDVALUE(ent, eval_items2);
-       if (val)
+       if (gamemode == GAME_HIPNOTIC || gamemode == GAME_ROGUE)
                items = (int)ent->fields.server->items | ((int)val->_float << 23);
        else
                items = (int)ent->fields.server->items | ((int)prog->globals.server->serverflags << 28);
@@ -1523,8 +1524,8 @@ Tell all the clients that the server is changing levels
 */
 void SV_SendReconnect (void)
 {
-       char    data[128];
-       sizebuf_t       msg;
+       qbyte data[128];
+       sizebuf_t msg;
 
        msg.data = data;
        msg.cursize = 0;
@@ -1622,7 +1623,7 @@ void SV_SpawnServer (const char *server)
 {
        prvm_edict_t *ent;
        int i;
-       qbyte *entities;
+       char *entities;
        model_t *worldmodel;
        char modelname[sizeof(sv.modelname)];
 
@@ -1679,6 +1680,8 @@ void SV_SpawnServer (const char *server)
 
        memset (&sv, 0, sizeof(sv));
 
+       SV_VM_Setup();
+
        sv.active = true;
 
        strlcpy (sv.name, server, sizeof (sv.name));
@@ -1692,8 +1695,6 @@ void SV_SpawnServer (const char *server)
                sv.protocol = PROTOCOL_QUAKE;
        }
 
-       SV_VM_Setup();
-
        SV_VM_Begin();
 
 // load progs to get entity field count
@@ -1711,7 +1712,7 @@ void SV_SpawnServer (const char *server)
        // progs fields, often accessed by server
        prog->edictsfields = PR_Alloc(prog->max_edicts * prog->edict_size);*/
        // used by PushMove to move back pushed entities
-       sv.moved_edicts = PRVM_Alloc(prog->max_edicts * sizeof(prvm_edict_t *));
+       sv.moved_edicts = (prvm_edict_t **)PRVM_Alloc(prog->max_edicts * sizeof(prvm_edict_t *));
        /*for (i = 0;i < prog->max_edicts;i++)
        {
                ent = prog->edicts + i;
@@ -1792,7 +1793,7 @@ void SV_SpawnServer (const char *server)
        // load replacement entity file if found
        entities = NULL;
        if (sv_entpatch.integer)
-               entities = FS_LoadFile(va("maps/%s.ent", sv.name), tempmempool, true);
+               entities = (char *)FS_LoadFile(va("maps/%s.ent", sv.name), tempmempool, true);
        if (entities)
        {
                Con_Printf("Loaded maps/%s.ent\n", sv.name);
@@ -1810,6 +1811,11 @@ void SV_SpawnServer (const char *server)
        sv.state = ss_active;
        prog->allowworldwrites = false;
 
+       // we need to reset the spawned flag on all connected clients here so that
+       // their thinks don't run during startup (before PutClientInServer)
+       for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
+               host_client->spawned = false;
+
 // run two frames to allow everything to settle
        for (i = 0;i < 2;i++)
        {
@@ -1844,7 +1850,7 @@ void SV_VM_CB_BeginIncreaseEdicts(void)
        prvm_edict_t *ent;
 
        PRVM_Free( sv.moved_edicts );
-       sv.moved_edicts = PRVM_Alloc(prog->max_edicts * sizeof(prvm_edict_t *));
+       sv.moved_edicts = (prvm_edict_t **)PRVM_Alloc(prog->max_edicts * sizeof(prvm_edict_t *));
 
        // links don't survive the transition, so unlink everything
        for (i = 0, ent = prog->edicts;i < prog->max_edicts;i++, ent++)