]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_main.c
reworked sendsignon logic so that unlimited sends are allowed once
[xonotic/darkplaces.git] / sv_main.c
index 47b474e5b85da6976dfb4bd9a40982c92c102094..facd0dabac503df32158197604a1a2693608d83b 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -714,7 +714,7 @@ void SV_SendServerinfo (client_t *client)
        MSG_WriteByte (&client->netconnection->message, 1);
 
        client->spawned = false;                // need prespawn, spawn, etc
-       client->sendsignon = true;              // send this message, this will be cleared later
+       client->sendsignon = 1;                 // send this message, and increment to 2, 2 will be set to 0 by the prespawn command
 
        // clear movement info until client enters the new level properly
        memset(&client->cmd, 0, sizeof(client->cmd));
@@ -1392,6 +1392,8 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t
        statsf[STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION] = sv_airaccel_sideways_friction.value;
        statsf[STAT_MOVEVARS_FRICTION] = sv_friction.value;
        statsf[STAT_MOVEVARS_WATERFRICTION] = sv_waterfriction.value >= 0 ? sv_waterfriction.value : sv_friction.value;
+       statsf[STAT_FRAGLIMIT] = fraglimit.value;
+       statsf[STAT_TIMELIMIT] = timelimit.value;
 
        if (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_QUAKEDP || sv.protocol == PROTOCOL_NEHAHRAMOVIE || sv.protocol == PROTOCOL_DARKPLACES1 || sv.protocol == PROTOCOL_DARKPLACES2 || sv.protocol == PROTOCOL_DARKPLACES3 || sv.protocol == PROTOCOL_DARKPLACES4 || sv.protocol == PROTOCOL_DARKPLACES5)
        {
@@ -1682,9 +1684,9 @@ static void SV_SendClientDatagram (client_t *client)
        }
 
 // send the datagram
-       NetConn_SendUnreliableMessage (client->netconnection, &msg, sv.protocol, clientrate, !client->spawned && !client->sendsignon);
-       if (!client->netconnection->message.cursize)
-               client->sendsignon = false;
+       NetConn_SendUnreliableMessage (client->netconnection, &msg, sv.protocol, clientrate, client->sendsignon == 2);
+       if (client->sendsignon == 1 && !client->netconnection->message.cursize)
+               client->sendsignon = 2; // prevent reliable until client sends prespawn (this is the keepalive phase)
 }
 
 /*
@@ -1717,7 +1719,7 @@ static void SV_UpdateToReliableMessages (void)
                if (strcmp(host_client->old_name, host_client->name))
                {
                        if (host_client->spawned)
-                               SV_BroadcastPrintf("%s^%i changed name to %s\n", host_client->old_name, STRING_COLOR_DEFAULT, host_client->name);
+                               SV_BroadcastPrintf("%s changed name to %s\n", host_client->old_name, host_client->name);
                        strlcpy(host_client->old_name, host_client->name, sizeof(host_client->old_name));
                        // send notification to all clients
                        MSG_WriteByte (&sv.reliable_datagram, svc_updatename);
@@ -1948,6 +1950,7 @@ static void SV_Download_f(void)
 
        host_client->download_expectedposition = 0;
        host_client->download_started = false;
+       host_client->sendsignon = true; // make sure this message is sent
 
        // the rest of the download process is handled in SV_SendClientDatagram
        // and other code dealing with svc_downloaddata and clc_ackdownloaddata