]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_main.c
fixed bug that caused SV_SpawnServer to fail to send reconnect commands to clients...
[xonotic/darkplaces.git] / sv_main.c
index 92e123139e848909c7ae729d0fb97095af13b65a..648e107bebbf6836fac9c3c96bcd0befdb50ee1b 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -426,10 +426,10 @@ void SV_ConnectClient (int clientnum, netconn_t *netconnection)
                PRVM_ExecuteProgram (prog->globals.server->SetNewParms, "QC function SetNewParms is missing");
                for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
                        client->spawn_parms[i] = (&prog->globals.server->parm1)[i];
-       }
 
-       // set up the entity for this client (including .colormap, .team, etc)
-       PRVM_ED_ClearEdict(client->edict);
+               // set up the entity for this client (including .colormap, .team, etc)
+               PRVM_ED_ClearEdict(client->edict);
+       }
 
        // don't call SendServerinfo for a fresh botclient because its fields have
        // not been set up by the qc yet
@@ -1246,7 +1246,7 @@ void SV_SendClientDatagram (client_t *client)
        }
 
 // send the datagram
-       NetConn_SendUnreliableMessage (client->netconnection, &msg);
+       NetConn_SendUnreliableMessage (client->netconnection, &msg, sv.protocol);
 }
 
 /*
@@ -1349,6 +1349,9 @@ void SV_SendClientMessages (void)
 {
        int i, prepared = false;
 
+       if (sv.protocol == PROTOCOL_QUAKEWORLD)
+               Sys_Error("SV_SendClientMessages: no quakeworld support\n");
+
 // update frags, names, etc
        SV_UpdateToReliableMessages();
 
@@ -1670,11 +1673,15 @@ void SV_SpawnServer (const char *server)
 //
        if (sv.active)
        {
-               // Tell all the clients that the server is changing levels
-               SV_VM_Begin();
-               MSG_WriteByte(&sv.reliable_datagram, svc_stufftext);
-               MSG_WriteString(&sv.reliable_datagram, "reconnect\n");
-               SV_VM_End();
+               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
        {