mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-31 22:19:44 +01:00
Add function Game::returnmenu()
It simply goes to the previous menu stack frame.
This commit is contained in:
parent
de0205e09b
commit
bf4427c75a
2 changed files with 25 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -115,6 +115,7 @@ public:
|
|||
|
||||
std::string timetstring(int t);
|
||||
|
||||
void returnmenu();
|
||||
void createmenu(enum Menu::MenuName t, bool samemenu = false);
|
||||
|
||||
void lifesequence();
|
||||
|
|
Loading…
Reference in a new issue