mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-11-05 02:39:41 +01:00
Fix kludge_ingametemp being assigned after menu creation
While working on #535, I noticed this bug. When going to Graphic Options or Game Options from the pause menu, kludge_ingametemp was intended to save the current menu stack frame BEFORE either of those menus got created. However, it was actually assigned afterwards, meaning kludge_ingametemp would always be either Menu::graphicoptions or Menu::options. This meant that the returntomenu() in returntopausemenu() would always attempt to return to the current in-game menu, and seeing as it's the same menu, would re-create the menu, instead of returning to the previous menu before it. This patch also fixes a potential source of a trivial memory leak, if someone were to keep entering and exiting Graphic Options or Game Options from the pause menu. It would keep piling up duplicate Graphic Options or Game Options stack frames, which would never get removed. However, they do get removed when you exit to the menu properly, by returntomenu() again, so this doesn't seem like that serious of an issue, but it's still good to fix.
This commit is contained in:
parent
e3aa768034
commit
a6c3b3432c
1 changed files with 4 additions and 1 deletions
|
@ -2389,6 +2389,10 @@ void mapmenuactionpress()
|
||||||
game.gamestate = TITLEMODE;
|
game.gamestate = TITLEMODE;
|
||||||
graphics.flipmode = false;
|
graphics.flipmode = false;
|
||||||
game.ingame_titlemode = true;
|
game.ingame_titlemode = true;
|
||||||
|
|
||||||
|
// Set this before we create the menu
|
||||||
|
game.kludge_ingametemp = game.currentmenuname;
|
||||||
|
|
||||||
if (game.menupage == 32)
|
if (game.menupage == 32)
|
||||||
{
|
{
|
||||||
game.createmenu(Menu::graphicoptions);
|
game.createmenu(Menu::graphicoptions);
|
||||||
|
@ -2397,7 +2401,6 @@ void mapmenuactionpress()
|
||||||
{
|
{
|
||||||
game.createmenu(Menu::options);
|
game.createmenu(Menu::options);
|
||||||
}
|
}
|
||||||
game.kludge_ingametemp = game.currentmenuname;
|
|
||||||
|
|
||||||
map.nexttowercolour();
|
map.nexttowercolour();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue