}
if (cl_message.cursize > cl_message.maxsize)
{
- CL_Disconnect(false, "Demo message (%i) > cl_message.maxsize (%i)", cl_message.cursize, cl_message.maxsize);
+ CL_DisconnectEx(false, "Demo message (%i) > cl_message.maxsize (%i)", cl_message.cursize, cl_message.maxsize);
cl_message.cursize = 0;
return;
}
}
else
{
- CL_Disconnect(false, NULL);
+ CL_Disconnect();
return;
}
}
}
if (cls.state == ca_connected)
- CL_Disconnect(false, NULL);
+ CL_Disconnect();
// write the forced cd track number, or -1
if (c == 4)
cls.demostarting = true;
// disconnect from server
- CL_Disconnect(false, NULL);
+ CL_Disconnect();
// update networking ports (this is mainly just needed at startup)
NetConn_UpdateSockets();
return;
if (cls.demonum == -1)
cls.demonum = 1;
- CL_Disconnect(false, NULL);
+ CL_Disconnect();
CL_NextDemo();
}
{
if (!cls.demoplayback)
return;
- CL_Disconnect(false, NULL);
+ CL_Disconnect();
}
// LadyHavoc: pausedemo command
in_impulse = 0;
if (cls.netcon->message.overflowed)
- CL_Disconnect(true, "Lost connection to server");
+ CL_DisconnectEx(true, "Lost connection to server");
}
/*
This is also called on Host_Error, so it shouldn't cause any errors
=====================
*/
-void CL_Disconnect(qbool kicked, const char *fmt, ... )
+
+void CL_DisconnectEx(qbool kicked, const char *fmt, ... )
{
va_list argptr;
char reason[512];
host.hook.SV_Shutdown();
}
+void CL_Disconnect(void)
+{
+ CL_DisconnectEx(false, NULL);
+}
+
/*
==================
CL_Reconnect_f
void CL_Disconnect_f(cmd_state_t *cmd)
{
- CL_Disconnect(false, Cmd_Argc(cmd) > 1 ? Cmd_Argv(cmd, 1) : NULL);
+ Cmd_Argc(cmd) < 1 ? CL_Disconnect() : CL_DisconnectEx(false, Cmd_Argv(cmd, 1));
}
S_StopAllSounds();
// disconnect client from server if active
- CL_Disconnect(false, NULL);
+ CL_Disconnect();
CL_Video_Shutdown();
NetConn_UpdateSockets_Client();
host.hook.ConnectLocal = CL_EstablishConnection_Local;
- host.hook.Disconnect = CL_Disconnect;
+ host.hook.Disconnect = CL_DisconnectEx;
host.hook.CL_Intermission = CL_Intermission;
host.hook.ToggleMenu = CL_ToggleMenu_Hook;
}
if (cls.demonum != -1)
CL_NextDemo();
else
- CL_Disconnect(true, NULL);
+ CL_DisconnectEx(true, "Server disconnected");
break;
case qw_svc_print:
if (cls.demonum != -1)
CL_NextDemo();
else
- CL_Disconnect(true, cls.protocol == PROTOCOL_DARKPLACES8 ? MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)) : NULL);
+ CL_DisconnectEx(true, cls.protocol == PROTOCOL_DARKPLACES8 ? MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)) : "Server disconnected");
break;
case svc_print:
void CL_EstablishConnection(const char *host, int firstarg);
-void CL_Disconnect (qbool kicked, const char *reason, ... );
+void CL_Disconnect(void);
+void CL_DisconnectEx(qbool kicked, const char *reason, ... );
void CL_Disconnect_f(cmd_state_t *cmd);
void CL_UpdateRenderEntity(entity_render_t *ent);
else
{
Mem_Free(csprogsdata);
- CL_Disconnect(false, "Your %s is not the same version as the server (CRC is %i/%i but should be %i/%i)\n", csqc_progname.string, csprogsdatacrc, (int)csprogsdatasize, requiredcrc, requiredsize);
+ CL_DisconnectEx(false, "Your %s is not the same version as the server (CRC is %i/%i but should be %i/%i)\n", csqc_progname.string, csprogsdatacrc, (int)csprogsdatasize, requiredcrc, requiredsize);
return;
}
}
else
{
if (requiredcrc >= 0)
- CL_Disconnect(false, CON_ERROR "CL_VM_Init: %s requires CSQC, but \"%s\" wasn't found\n", cls.demoplayback ? "demo" : "server", csqc_progname.string);
+ CL_DisconnectEx(false, CON_ERROR "CL_VM_Init: %s requires CSQC, but \"%s\" wasn't found\n", cls.demoplayback ? "demo" : "server", csqc_progname.string);
return;
}
if (cls.demoplayback)
{
- CL_Disconnect(false, NULL);
+ CL_Disconnect();
cls.demonum = 0;
}
}
// halt demo playback to close the file
- CL_Disconnect(false, NULL);
+ CL_Disconnect();
FS_ChangeGameDirs(numgamedirs, gamedirs, true, true);
}
if (cls.state == ca_dedicated)
Sys_Error ("Host_Error: %s",hosterrorstring2); // dedicated servers exit
- CL_Disconnect (false, NULL);
+ CL_Disconnect();
cls.demonum = -1;
hosterror = false;
dpsnprintf(donecommand, sizeof(donecommand), "connect %s", cls.netcon->address);
Curl_CommandWhenDone(donecommand);
noclear = true;
- CL_Disconnect(false, NULL);
+ CL_Disconnect();
noclear = false;
Curl_CheckCommandWhenDone();
}
#endif
// Disconnect from the current server or stop demo playback
if(cls.state == ca_connected || cls.demoplayback)
- CL_Disconnect(false, NULL);
+ CL_Disconnect();
// allocate a net connection to keep track of things
cls.netcon = NetConn_Open(mysocket, peeraddress);
crypto = &cls.netcon->crypto;
NetConn_QueryQueueFrame();
#endif
if (cls.netcon && host.realtime > cls.netcon->timeout && !sv.active)
- CL_Disconnect(true, "Connection timed out");
+ CL_DisconnectEx(true, "Connection timed out");
}
static void NetConn_BuildChallengeString(char *buffer, int bufferlength)
// stop playing demos
if (cls.demoplayback)
- CL_Disconnect (false, NULL);
+ CL_Disconnect();
#ifdef CONFIG_MENU
// remove menu