]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_main.c
Tell clients to reconnect before loading the next map. Should fix lag/stutter
[xonotic/darkplaces.git] / sv_main.c
index 19f455370c1fd85086bda56d75c90d4e27721680..f89c307314260af5083f2abd27a6bc5104d16c1d 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -414,13 +414,10 @@ prvm_required_field_t sv_reqglobals[] =
 #undef PRVM_DECLARE_function
 };
 
-static void Host_Timescale_c(char *string)
+static void Host_Timescale_c(cvar_t *var)
 {
-       double value;
-       value = atof(string);
-
-       if(value < 0.00001 && value != 0)
-               string[0] = '0', string[1] = 0;
+       if(var->value < 0.00001 && var->value != 0)
+               Cvar_SetValueQuick(var, 0);
 }
 
 //============================================================================
@@ -626,6 +623,8 @@ void SV_Init (void)
        Cvar_RegisterVariable (&sv_mapformat_is_quake2);
        Cvar_RegisterVariable (&sv_mapformat_is_quake3);
 
+       SV_InitOperatorCommands();
+
        sv_mempool = Mem_AllocPool("server", 0, NULL);
 }
 
@@ -3441,6 +3440,15 @@ void SV_SpawnServer (const char *server)
 
        if(sv.active)
        {
+               client_t *client;
+               for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++)
+               {
+                       if (client->netconnection)
+                       {
+                               MSG_WriteByte(&client->netconnection->message, svc_stufftext);
+                               MSG_WriteString(&client->netconnection->message, "reconnect\n");
+                       }
+               }
                World_End(&sv.world);
                if(PRVM_serverfunction(SV_Shutdown))
                {
@@ -3483,23 +3491,8 @@ void SV_SpawnServer (const char *server)
 //
 // tell all connected clients that we are going to a new level
 //
-       if (sv.active)
-       {
-               client_t *client;
-               for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++)
-               {
-                       if (client->netconnection)
-                       {
-                               MSG_WriteByte(&client->netconnection->message, svc_stufftext);
-                               MSG_WriteString(&client->netconnection->message, "reconnect\n");
-                       }
-               }
-       }
-       else
-       {
-               // open server port
+       if (!sv.active)
                NetConn_OpenServerPorts(true);
-       }
 
 //
 // make cvars consistant