mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 09:28:15 +03: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:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user