mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 09:28:15 +03:00
Add function Game::returntomenu()
When exiting from a game-gamestate which may have been entered through a varying amount of menus, the solution is to not use Game::returnmenu(), and to instead have a way to go back to a certain given menu.
This commit is contained in:
@@ -6588,6 +6588,32 @@ void Game::returnmenu()
|
||||
}
|
||||
}
|
||||
|
||||
void Game::returntomenu(enum Menu::MenuName t)
|
||||
{
|
||||
if (currentmenuname == t)
|
||||
{
|
||||
//Why are you calling this function then?
|
||||
return;
|
||||
}
|
||||
|
||||
//Unwind the menu stack until we reach our desired menu
|
||||
int i = menustack.size() - 1;
|
||||
while (i >= 0)
|
||||
{
|
||||
//If we pop it off we can't reference it anymore, so check for it now
|
||||
bool is_the_menu_we_want = menustack[i].name == t;
|
||||
|
||||
returnmenu();
|
||||
|
||||
if (is_the_menu_we_want)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
||||
{
|
||||
if (t == Menu::mainmenu)
|
||||
|
||||
@@ -106,6 +106,7 @@ public:
|
||||
std::string timetstring(int t);
|
||||
|
||||
void returnmenu();
|
||||
void returntomenu(enum Menu::MenuName t);
|
||||
void createmenu(enum Menu::MenuName t, bool samemenu = false);
|
||||
|
||||
void lifesequence();
|
||||
|
||||
Reference in New Issue
Block a user