mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-26 22:40:50 +00:00
Disconnect when we're connected before starting an new game.
The old code was working only when the client was connected to a local server. The 'newgame' executed by the menu expands to a 'map', loading a map ends in SV_InitGame() which calls CL_Drop() on the local client. That calls CL_Disconnect() and everything is okay. When the client is already connected to a remote server and no local server is running the 'map' command spawns a new local server. This new server thinks "Hey, I'm a new local server and no one is connected to me. Let's pull the client in!". So it pull the already connected client onto a new server without disconnecting, smashing it's state. And everything goes down in flames. The correct way would be to execute a 'disconnect' right before the 'newgame'. But the 'disconnect' cmd calls CL_Disconnect_f that throws an ERR_DROP. ERR_DROP is implememted through a longjump(), jumping around puts the process internal state in ashes... So bite the bullet and add another hack: Call CL_Disconnect() before executing 'newgame'.
This commit is contained in:
parent
ed54fe2364
commit
808a208de4
1 changed files with 5 additions and 0 deletions
|
@ -2085,6 +2085,11 @@ static menuseparator_s s_blankline;
|
|||
static void
|
||||
StartGame(void)
|
||||
{
|
||||
if (cls.state != ca_disconnected && cls.state != ca_uninitialized)
|
||||
{
|
||||
CL_Disconnect();
|
||||
}
|
||||
|
||||
/* disable updates and start the cinematic going */
|
||||
cl.servercount = -1;
|
||||
M_ForceMenuOff();
|
||||
|
|
Loading…
Reference in a new issue