mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-08 18:09:45 +01:00
Improve ed_settings Esc press handling
This fixes being able to rack up a large amount of stack frames by pressing Esc repeatedly in the editor, which would be a problem if you were to then return to the main menu afterwards. Instead, if Menu::ed_settings is already in the stack, the game will simply return to that menu instead of creating it. Else, it will just create the menu. Also, as extra attention to detail, I made sure that the menu create or return only happens if Esc opens the settings menu, and not when Esc is closes it.
This commit is contained in:
parent
98e33fca9e
commit
dc2adea8ee
1 changed files with 21 additions and 2 deletions
|
@ -3719,8 +3719,27 @@ void editorinput()
|
|||
ed.settingsmod=!ed.settingsmod;
|
||||
graphics.backgrounddrawn=false;
|
||||
|
||||
game.createmenu(Menu::ed_settings);
|
||||
map.nexttowercolour();
|
||||
if (ed.settingsmod)
|
||||
{
|
||||
bool edsettings_in_stack = false;
|
||||
for (size_t i = 0; i < game.menustack.size(); i++)
|
||||
{
|
||||
if (game.menustack[i].name == Menu::ed_settings)
|
||||
{
|
||||
edsettings_in_stack = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (edsettings_in_stack)
|
||||
{
|
||||
game.returntomenu(Menu::ed_settings);
|
||||
}
|
||||
else
|
||||
{
|
||||
game.createmenu(Menu::ed_settings);
|
||||
}
|
||||
map.nexttowercolour();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue