]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_main.c
move sv.active = true; up to fix a VM_bprint warning
[xonotic/darkplaces.git] / sv_main.c
index 63dd5a81d7767e23814306232899d9243184ce02..18042424a92564bfc37dee59128f711e7676e44c 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -110,7 +110,7 @@ static void SV_SaveEntFile_f(void)
                return;
        }
        FS_StripExtension(sv.worldmodel->name, basename, sizeof(basename));
-       FS_WriteFile(va("%s.ent", basename), sv.worldmodel->brush.entities, strlen(sv.worldmodel->brush.entities));
+       FS_WriteFile(va("%s.ent", basename), sv.worldmodel->brush.entities, (fs_offset_t)strlen(sv.worldmodel->brush.entities));
 }
 
 
@@ -209,13 +209,22 @@ void SV_StartSound (prvm_edict_t *entity, int channel, const char *sample, int v
        int sound_num, field_mask, i, ent;
 
        if (volume < 0 || volume > 255)
-               Host_Error ("SV_StartSound: volume = %i", volume);
+       {
+               Con_Printf ("SV_StartSound: volume = %i", volume);
+               return;
+       }
 
        if (attenuation < 0 || attenuation > 4)
-               Host_Error ("SV_StartSound: attenuation = %f", attenuation);
+       {
+               Con_Printf ("SV_StartSound: attenuation = %f", attenuation);
+               return;
+       }
 
        if (channel < 0 || channel > 7)
-               Host_Error ("SV_StartSound: channel = %i", channel);
+       {
+               Con_Printf ("SV_StartSound: channel = %i", channel);
+               return;
+       }
 
        if (sv.datagram.cursize > MAX_PACKETFRAGMENT-21)
                return;
@@ -1669,6 +1678,8 @@ void SV_SpawnServer (const char *server)
 
        memset (&sv, 0, sizeof(sv));
 
+       sv.active = true;
+
        strlcpy (sv.name, server, sizeof (sv.name));
 
        sv.protocol = Protocol_EnumForName(sv_protocolname.string);
@@ -1727,6 +1738,7 @@ void SV_SpawnServer (const char *server)
        //prog->num_edicts = svs.maxclients+1;
 
        sv.state = ss_loading;
+       prog->allowworldwrites = true;
        sv.paused = false;
 
        *prog->time = sv.time = 1.0;
@@ -1793,10 +1805,9 @@ void SV_SpawnServer (const char *server)
        // LordHavoc: clear world angles (to fix e3m3.bsp)
        VectorClear(prog->edicts->fields.server->angles);
 
-       sv.active = true;
-
 // all setup is completed, any further precache statements are errors
        sv.state = ss_active;
+       prog->allowworldwrites = false;
 
 // run two frames to allow everything to settle
        for (i = 0;i < 2;i++)
@@ -1869,7 +1880,7 @@ void SV_VM_CB_InitEdict(prvm_edict_t *e)
                e->fields.server->colormap = num + 1;
                e->fields.server->team = (svs.clients[num].colors & 15) + 1;
                // set netname/clientcolors back to client values so that
-               // DP_SV_CLIENTNAME and DPV_SV_CLIENTCOLORS will not immediately
+               // DP_SV_CLIENTNAME and DP_SV_CLIENTCOLORS will not immediately
                // reset them
                e->fields.server->netname = PRVM_SetEngineString(svs.clients[num].name);
                if ((val = PRVM_GETEDICTFIELDVALUE(e, eval_clientcolors)))