Skip to content

Commit e4d1970

Browse files
committedMar 13, 2014
Fix game pause in singleplayer
1 parent 03297ac commit e4d1970

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed
 

‎src/game.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,7 @@ static void show_chat_menu(FormspecFormSource* current_formspec,
988988
new GUIFormSpecMenu(device, guiroot, -1,
989989
&g_menumgr,
990990
NULL, NULL, tsrc);
991+
menu->doPause = false;
991992
menu->setFormSource(current_formspec);
992993
menu->setTextDest(current_textdest);
993994
menu->drop();
@@ -1034,6 +1035,7 @@ static void show_pause_menu(FormspecFormSource* current_formspec,
10341035
current_textdest = new LocalFormspecHandler("MT_PAUSE_MENU");
10351036
GUIFormSpecMenu *menu =
10361037
new GUIFormSpecMenu(device, guiroot, -1, &g_menumgr, NULL, NULL, tsrc);
1038+
menu->doPause = true;
10371039
menu->setFormSource(current_formspec);
10381040
menu->setTextDest(current_textdest);
10391041
menu->drop();
@@ -1881,6 +1883,7 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
18811883

18821884
PlayerInventoryFormSource *src = new PlayerInventoryFormSource(&client);
18831885
assert(src);
1886+
menu->doPause = false;
18841887
menu->setFormSpec(src->getForm(), inventoryloc);
18851888
menu->setFormSource(src);
18861889
menu->setTextDest(new TextDestPlayerInventory(&client));
@@ -2399,6 +2402,7 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
23992402
new GUIFormSpecMenu(device, guiroot, -1,
24002403
&g_menumgr,
24012404
&client, gamedef, tsrc);
2405+
menu->doPause = false;
24022406
menu->setFormSource(current_formspec);
24032407
menu->setTextDest(current_textdest);
24042408
menu->drop();
@@ -2953,6 +2957,7 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
29532957
new GUIFormSpecMenu(device, guiroot, -1,
29542958
&g_menumgr,
29552959
&client, gamedef, tsrc);
2960+
menu->doPause = false;
29562961
menu->setFormSpec(meta->getString("formspec"),
29572962
inventoryloc);
29582963
menu->setFormSource(new NodeMetadataFormSource(

‎src/guiFormSpecMenu.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2320,6 +2320,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
23202320
kp == getKeySetting("keymap_inventory")))
23212321
{
23222322
if (m_allowclose){
2323+
doPause = false;
23232324
acceptInput(quit_mode_cancel);
23242325
quitMenu();
23252326
} else {

‎src/guiFormSpecMenu.h

+2
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ class GUIFormSpecMenu : public GUIModalMenu
242242
void acceptInput(FormspecQuitMode quitmode);
243243
bool preprocessEvent(const SEvent& event);
244244
bool OnEvent(const SEvent& event);
245+
bool doPause;
246+
bool pausesGame() { return doPause; }
245247

246248
GUITable* getTable(std::wstring tablename);
247249

0 commit comments

Comments
 (0)
Please sign in to comment.