]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
made reconnect command reconnect to the last server you were on, even if it was an...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 20 Feb 2007 03:25:24 +0000 (03:25 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 20 Feb 2007 03:25:24 +0000 (03:25 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6875 d7cf8633-e32d-0410-b094-e92efae38249

host_cmd.c

index 88e6354ca548ea59ce80ff96ede9dd68bd226f8a..97365a4fef62d8227f0ff8486de206abda6f6650 100644 (file)
@@ -371,36 +371,38 @@ This is sent just before a server changes levels
 */
 void Host_Reconnect_f (void)
 {
+       char temp[128];
+       // if not connected, reconnect to the most recent server
+       if (!cls.netcon)
+       {
+               // if we have connected to a server recently, the userinfo
+               // will still contain its IP address, so get the address...
+               InfoString_GetValue(cls.userinfo, "*ip", temp, sizeof(temp));
+               if (temp[0])
+                       CL_EstablishConnection(temp);
+               else
+                       Con_Printf("Reconnect to what server?  (you have not connected to a server yet)\n");
+               return;
+       }
+       // if connected, do something based on protocol
        if (cls.protocol == PROTOCOL_QUAKEWORLD)
        {
+               // quakeworld can just re-login
                if (cls.qw_downloadmemory)  // don't change when downloading
                        return;
 
                S_StopAllSounds();
 
-               if (cls.netcon)
+               if (cls.state == ca_connected && cls.signon < SIGNONS)
                {
-                       if (cls.state == ca_connected && cls.signon < SIGNONS)
-                       {
-                               Con_Printf("reconnecting...\n");
-                               MSG_WriteChar(&cls.netcon->message, qw_clc_stringcmd);
-                               MSG_WriteString(&cls.netcon->message, "new");
-                       }
-                       else
-                       {
-                               char temp[128];
-                               // if we have connected to a server recently, the userinfo
-                               // will still contain its IP address, so get the address...
-                               InfoString_GetValue(cls.userinfo, "*ip", temp, sizeof(temp));
-                               if (temp[0])
-                                       CL_EstablishConnection(temp);
-                               else
-                                       Con_Printf("Reconnect to what server?  (you have not connected to a server yet)\n");
-                       }
+                       Con_Printf("reconnecting...\n");
+                       MSG_WriteChar(&cls.netcon->message, qw_clc_stringcmd);
+                       MSG_WriteString(&cls.netcon->message, "new");
                }
        }
        else
        {
+               // netquake uses reconnect on level changes (silly)
                if (Cmd_Argc() != 1)
                {
                        Con_Print("reconnect : wait for signon messages again\n");