Fix '/connect $server' while connected to a server.

This commit is contained in:
Yamagi Burmeister 2018-02-27 19:17:45 +01:00
parent 727249f625
commit ed54fe2364

View file

@ -189,7 +189,7 @@ CL_CheckForResend(void)
void void
CL_Connect_f(void) CL_Connect_f(void)
{ {
char *server; char server[256];
if (Cmd_Argc() != 2) if (Cmd_Argc() != 2)
{ {
@ -197,6 +197,8 @@ CL_Connect_f(void)
return; return;
} }
Q_strlcpy(server, Cmd_Argv(1), sizeof(server));
if (Com_ServerState()) if (Com_ServerState())
{ {
/* if running a local server, kill it and reissue /* if running a local server, kill it and reissue
@ -204,15 +206,7 @@ CL_Connect_f(void)
SV_Shutdown("Server quit\n", false); SV_Shutdown("Server quit\n", false);
} }
else
{
CL_Disconnect();
}
server = Cmd_Argv(1);
NET_Config(true); /* allow remote */ NET_Config(true); /* allow remote */
CL_Disconnect(); CL_Disconnect();
cls.state = ca_connecting; cls.state = ca_connecting;