1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2025-01-09 18:39: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:
Misa 2020-04-25 19:37:33 -07:00 committed by Ethan Lee
parent 98e33fca9e
commit dc2adea8ee

View file

@ -3719,10 +3719,29 @@ void editorinput()
ed.settingsmod=!ed.settingsmod; ed.settingsmod=!ed.settingsmod;
graphics.backgrounddrawn=false; graphics.backgrounddrawn=false;
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); game.createmenu(Menu::ed_settings);
}
map.nexttowercolour(); map.nexttowercolour();
} }
} }
}
if (!key.isDown(27)) if (!key.isDown(27))
{ {