]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fixed NET_SendToAll
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 2 Apr 2003 00:20:10 +0000 (00:20 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 2 Apr 2003 00:20:10 +0000 (00:20 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2891 d7cf8633-e32d-0410-b094-e92efae38249

net_main.c

index 9b5d556673bcf27672cfd9017c449d64a1d8ddff..b03c426271b049fface622e18b0cc2e8abedaa80 100644 (file)
@@ -812,7 +812,16 @@ int NET_SendToAll(sizebuf_t *data, int blocktime)
        qbyte           state [MAX_SCOREBOARD];
 
        for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
-               state[i] = (host_client->netconnection && host_client->active) ? 0 : 2;
+       {
+               state[i] = 2;
+               if (host_client->netconnection && host_client->active)
+               {
+                       if (host_client->netconnection->driver == 0)
+                               NET_SendMessage(host_client->netconnection, data);
+                       else
+                               state[i] = 0;
+               }
+       }
 
        // for every player (simultaneously) wait for the first CanSendMessage
        // and send the message, then wait for a second CanSendMessage (verifying
@@ -825,23 +834,16 @@ int NET_SendToAll(sizebuf_t *data, int blocktime)
                {
                        if (state[i] < 2)
                        {
+                               count++;
                                // need to send to this one
                                if (NET_CanSendMessage (host_client->netconnection))
                                {
-                                       if (state[i] == 0)
-                                       {
-                                               if (NET_SendMessage (host_client->netconnection, data) == 1)
-                                                       state[i] = 2; // connection lost
-                                               else
-                                                       count++;
-                                       }
+                                       if (state[i] == 0 && NET_SendMessage (host_client->netconnection, data) == -1)
+                                               state[i] = 2; // connection lost
                                        state[i]++;
                                }
                                else
-                               {
                                        NET_GetMessage (host_client->netconnection);
-                                       count++;
-                               }
                        }
                }
        }