Fix game pause in singleplayer
authorBlockMen <nmuelll@web.de>
Thu, 13 Mar 2014 13:06:18 +0000 (14:06 +0100)
committerBlockMen <nmuelll@web.de>
Thu, 13 Mar 2014 13:06:18 +0000 (14:06 +0100)
src/game.cpp
src/guiFormSpecMenu.cpp
src/guiFormSpecMenu.h

index a3c162457a2b0f035297e685e34b767980eb9a01..2b14b2c8e39fe5c46306787b8996c4aea813aba5 100644 (file)
@@ -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();
@@ -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();
@@ -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));
@@ -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();
@@ -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(
index 95a090c6fbbfacaa05a8c8085835e28f944790f5..4751978d7d3c63bead655a24e8bd7cd20a2839e7 100644 (file)
@@ -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 {
index 3fc1b5746a8a293f3c9a8e14da6e0bdd89549c79..6f7de158b505572018e379fd572d41ef1afcc976 100644 (file)
@@ -242,6 +242,8 @@ public:
        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);