1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-25 05:58:30 +02:00

Add function Game::returnmenu()

It simply goes to the previous menu stack frame.
This commit is contained in:
Misa 2020-04-16 19:16:40 -07:00 committed by Ethan Lee
parent de0205e09b
commit bf4427c75a
2 changed files with 25 additions and 0 deletions

View File

@ -6552,6 +6552,30 @@ std::string Game::timetstring( int t )
return tempstring;
}
void Game::returnmenu()
{
if (menustack.empty())
{
puts("Error: returning to previous menu frame on empty stack!");
return;
}
MenuStackFrame& frame = menustack[menustack.size()-1];
//Store this in case createmenu() removes the stack frame
int previousoption = frame.option;
createmenu(frame.name, true);
currentmenuoption = previousoption;
//Remove the stackframe now, but createmenu() might have already gotten to it
//if we were returning to the main menu
if (!menustack.empty())
{
menustack.pop_back();
}
}
void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
{
if (t == Menu::mainmenu)

View File

@ -115,6 +115,7 @@ public:
std::string timetstring(int t);
void returnmenu();
void createmenu(enum Menu::MenuName t, bool samemenu = false);
void lifesequence();