From 24d3cb4a8839849ac1a1ddcf97152315f5b18560 Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 20 Feb 2007 03:25:24 +0000 Subject: [PATCH] made reconnect command reconnect to the last server you were on, even if it was an nq server (previously this only worked on qw servers) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6875 d7cf8633-e32d-0410-b094-e92efae38249 --- host_cmd.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/host_cmd.c b/host_cmd.c index 88e6354c..97365a4f 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -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"); -- 2.39.2