Clear startdemo list on game change

This fixes inconsistent behavior when starting a game with -ad
vs starting with id1 and using 'game ad' in the console
(since id1 has startdemos in its quake.rc file, while ad doesn't).
This commit is contained in:
Andrei Drexler 2022-07-31 14:02:24 +03:00 committed by Ozkan Sezer
parent 47de22c84b
commit 1f6888e7bc
3 changed files with 15 additions and 0 deletions

View File

@ -2202,6 +2202,7 @@ static void COM_Game_f (void)
R_NewGame (); R_NewGame ();
} }
ExtraMaps_NewGame (); ExtraMaps_NewGame ();
Host_Resetdemos ();
DemoList_Rebuild (); DemoList_Rebuild ();
Con_Printf("\"game\" changed to \"%s\"\n", COM_SkipPath(com_gamedir)); Con_Printf("\"game\" changed to \"%s\"\n", COM_SkipPath(com_gamedir));

View File

@ -2271,6 +2271,19 @@ static void Host_Stopdemo_f (void)
CL_Disconnect (); CL_Disconnect ();
} }
/*
==================
Host_Resetdemos
Clear looping demo list (called on game change)
==================
*/
void Host_Resetdemos (void)
{
memset (cls.demos, 0, sizeof (cls.demos));
cls.demonum = 0;
}
//============================================================================= //=============================================================================
/* /*

View File

@ -315,6 +315,7 @@ void Host_Quit_f (void);
void Host_ClientCommands (const char *fmt, ...) FUNC_PRINTF(1,2); void Host_ClientCommands (const char *fmt, ...) FUNC_PRINTF(1,2);
void Host_ShutdownServer (qboolean crash); void Host_ShutdownServer (qboolean crash);
void Host_WriteConfiguration (void); void Host_WriteConfiguration (void);
void Host_Resetdemos (void);
void ExtraMaps_Init (void); void ExtraMaps_Init (void);
void Modlist_Init (void); void Modlist_Init (void);