]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - net_main.c
new entity protocol has been canceled due to a fatal design flaw only detected today...
[xonotic/darkplaces.git] / net_main.c
index 0d085bbe1e853eaf91409ab7620f9d76849845fb..51c3f3f41012f7f7b23aa247bc2d527eec09a741 100644 (file)
@@ -63,6 +63,7 @@ int unreliableMessagesReceived = 0;
 
 cvar_t net_messagetimeout = {0, "net_messagetimeout","300"};
 cvar_t hostname = {CVAR_SAVE, "hostname", "UNNAMED"};
+cvar_t developer_networking = {0, "developer_networking", "0"};
 
 qboolean       configRestored = false;
 
@@ -361,12 +362,7 @@ static void PrintSlistTrailer(void)
        if (hostCacheCount)
                Con_Printf("== end list ==\n\n");
        else
-       {
-               if (gamemode == GAME_TRANSFUSION)
-                       Con_Printf("No Transfusion servers found.\n\n");
-               else
-                       Con_Printf("No Quake servers found.\n\n");
-       }
+               Con_Printf("No %s servers found.\n\n", gamename);
 }
 
 
@@ -377,10 +373,7 @@ void NET_SlistCommon (PollProcedure *sendProcedure, PollProcedure *pollProcedure
 
        if (! slistSilent)
        {
-               if (gamemode == GAME_TRANSFUSION)
-                       Con_Printf("Looking for Transfusion servers...\n");
-               else
-                       Con_Printf("Looking for Quake servers...\n");
+               Con_Printf("Looking for %s servers...\n", gamename);
                PrintSlistHeader();
        }
 
@@ -811,7 +804,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
@@ -824,23 +826,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++;
-                               }
                        }
                }
        }
@@ -889,6 +884,7 @@ void NET_Init (void)
 
        Cvar_RegisterVariable (&net_messagetimeout);
        Cvar_RegisterVariable (&hostname);
+       Cvar_RegisterVariable (&developer_networking);
 
        Cmd_AddCommand ("net_slist", NET_Slist_f);
        Cmd_AddCommand ("net_inetslist", NET_InetSlist_f);