Skip to content

Commit

Permalink
Fix game pause in singleplayer
Browse files Browse the repository at this point in the history
  • Loading branch information
BlockMen committed Mar 13, 2014
1 parent 03297ac commit e4d1970
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/game.cpp
Expand Up @@ -988,6 +988,7 @@ static void show_chat_menu(FormspecFormSource* current_formspec,
new GUIFormSpecMenu(device, guiroot, -1,
&g_menumgr,
NULL, NULL, tsrc);
menu->doPause = false;
menu->setFormSource(current_formspec);
menu->setTextDest(current_textdest);
menu->drop();
Expand Down Expand Up @@ -1034,6 +1035,7 @@ static void show_pause_menu(FormspecFormSource* current_formspec,
current_textdest = new LocalFormspecHandler("MT_PAUSE_MENU");
GUIFormSpecMenu *menu =
new GUIFormSpecMenu(device, guiroot, -1, &g_menumgr, NULL, NULL, tsrc);
menu->doPause = true;
menu->setFormSource(current_formspec);
menu->setTextDest(current_textdest);
menu->drop();
Expand Down Expand Up @@ -1881,6 +1883,7 @@ void the_game(bool &kill, bool random_input, InputHandler *input,

PlayerInventoryFormSource *src = new PlayerInventoryFormSource(&client);
assert(src);
menu->doPause = false;
menu->setFormSpec(src->getForm(), inventoryloc);
menu->setFormSource(src);
menu->setTextDest(new TextDestPlayerInventory(&client));
Expand Down Expand Up @@ -2399,6 +2402,7 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
new GUIFormSpecMenu(device, guiroot, -1,
&g_menumgr,
&client, gamedef, tsrc);
menu->doPause = false;
menu->setFormSource(current_formspec);
menu->setTextDest(current_textdest);
menu->drop();
Expand Down Expand Up @@ -2953,6 +2957,7 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
new GUIFormSpecMenu(device, guiroot, -1,
&g_menumgr,
&client, gamedef, tsrc);
menu->doPause = false;
menu->setFormSpec(meta->getString("formspec"),
inventoryloc);
menu->setFormSource(new NodeMetadataFormSource(
Expand Down
1 change: 1 addition & 0 deletions src/guiFormSpecMenu.cpp
Expand Up @@ -2320,6 +2320,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
kp == getKeySetting("keymap_inventory")))
{
if (m_allowclose){
doPause = false;
acceptInput(quit_mode_cancel);
quitMenu();
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/guiFormSpecMenu.h
Expand Up @@ -242,6 +242,8 @@ class GUIFormSpecMenu : public GUIModalMenu
void acceptInput(FormspecQuitMode quitmode);
bool preprocessEvent(const SEvent& event);
bool OnEvent(const SEvent& event);
bool doPause;
bool pausesGame() { return doPause; }

GUITable* getTable(std::wstring tablename);

Expand Down

0 comments on commit e4d1970

Please sign in to comment.