D_ClearState, G_EndGame, G_GameEndTicker: Move netgame-specific server looping out of the general state-clearing function, for sanity's sake.

This commit is contained in:
toaster 2023-01-31 14:09:21 +00:00
parent 2d5d5343b1
commit 87ee91638e
3 changed files with 26 additions and 25 deletions

View file

@ -923,23 +923,6 @@ void D_ClearState(void)
S_StopMusic();
if (netgame)
{
G_SetGamestate(GS_WAITINGPLAYERS); // hack to prevent a command repeat
if (server)
{
i = G_GetFirstMapOfGametype(gametype)+1;
if (i > nummapheaders)
I_Error("D_ClearState: No valid map ID found!?");
COM_BufAddText(va("map %s\n", G_BuildMapName(i)));
}
return;
}
// okay, stop now
// (otherwise the game still thinks we're playing!)
SV_StopServer();
@ -995,9 +978,6 @@ void D_ClearState(void)
void D_StartTitle(void)
{
D_ClearState();
if (netgame)
return;
F_StartTitleScreen();
M_ClearMenus(false);
}

View file

@ -1638,9 +1638,14 @@ void F_GameEndDrawer(void)
void F_GameEndTicker(void)
{
if (timetonext > 0)
{
timetonext--;
}
else
D_StartTitle();
{
nextmap = NEXTMAP_TITLE;
G_EndGame();
}
}

View file

@ -4178,12 +4178,28 @@ void G_EndGame(void)
}
}
// direct or competitive multiplayer, so go back to title screen.
D_ClearState();
if (!netgame)
// In a netgame, don't unwittingly boot everyone.
if (netgame)
{
M_StartControlPanel();
S_StopMusic();
G_SetGamestate(GS_WAITINGPLAYERS); // hack to prevent a command repeat
if (server)
{
UINT16 map = G_GetFirstMapOfGametype(gametype)+1;
if (map > nummapheaders)
I_Error("G_EndGame: No valid map ID found!?");
COM_BufAddText(va("map %s\n", G_BuildMapName(map)));
}
return;
}
// Time to return to the menu.
D_ClearState();
M_StartControlPanel();
}
//