1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Add asserts if ingame_titlemode in unexpected places

The game will now assert if the main menu is created while
ingame_titlemode is true, or if we attempt to load into a mode while
it's true. And if assertions are disabled then it just stops doing it
anyway.

I don't think there's any way to get a glitched ingame_titlemode again,
ever since I removed save data deletion taking you back to the main
menu. But I've had enough bugs with the fact that we more-or-less use
the same state for main menu options and in-game options, and that
glitched ingame_titlemode bug DID just happen, so I'm taking
precautions.
This commit is contained in:
Misa 2021-12-17 23:36:13 -08:00
parent 5ebc65d1a2
commit 7f9247b0c7
2 changed files with 13 additions and 0 deletions

View file

@ -5905,6 +5905,12 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
switch (t)
{
case Menu::mainmenu:
if (ingame_titlemode)
{
/* We shouldn't be here! */
SDL_assert(0 && "Entering main menu from in-game options!");
break;
}
#if !defined(MAKEANDPLAY)
option("play");
#endif

View file

@ -290,6 +290,13 @@ static void startmode(const int mode)
static void handlefadetomode(void)
{
if (game.ingame_titlemode)
{
/* We shouldn't be here! */
SDL_assert(0 && "Loading a mode from in-game options!");
return;
}
if (fadetomodedelay > 0)
{
--fadetomodedelay;