diff --git a/source/core/menu/menu.h b/source/core/menu/menu.h index e19d84d5e..272d02a9c 100644 --- a/source/core/menu/menu.h +++ b/source/core/menu/menu.h @@ -766,7 +766,7 @@ void I_ReleaseMouseCapture(); struct MenuClassDescriptor; extern TArray menuClasses; -using hFunc = std::function; +using hFunc = std::function; DMenu* CreateMessageBoxMenu(DMenu* parent, const char* message, int messagemode, int scriptID, bool playsound, FName action = NAME_None, hFunc handler = nullptr); diff --git a/source/core/menu/messagebox.cpp b/source/core/menu/messagebox.cpp index ee3fccf01..4ea2e6d70 100644 --- a/source/core/menu/messagebox.cpp +++ b/source/core/menu/messagebox.cpp @@ -77,7 +77,7 @@ class DMessageBoxMenu : public DMenu int messageSelection; int mMouseLeft, mMouseRight, mMouseY; FName mAction; - std::function mActionFunc; + std::function mActionFunc; public: @@ -170,8 +170,7 @@ void DMessageBoxMenu::HandleResult(bool res) { if (mActionFunc) { - mActionFunc(res); - Close(); + if (mActionFunc(res)) Close(); } else if (mAction == NAME_None && mParentMenu) { @@ -433,7 +432,9 @@ CCMD (menu_endgame) STAT_Cancel(); M_ClearMenus(); gi->QuitToTitle(); + return false; } + return true; }); M_ActivateMenu(newmenu); @@ -456,6 +457,7 @@ CCMD (menu_quit) DMenu *newmenu = CreateMessageBoxMenu(CurrentMenu, EndString, 0, 500, false, NAME_None, [](bool res) { if (res) gi->ExitFromMenu(); + return true; }); M_ActivateMenu(newmenu); diff --git a/source/core/menu/savegamemanager.cpp b/source/core/menu/savegamemanager.cpp index 98992f0e6..66b20c4c4 100644 --- a/source/core/menu/savegamemanager.cpp +++ b/source/core/menu/savegamemanager.cpp @@ -668,6 +668,7 @@ CCMD(quicksave) { savegameManager.SaveGame(savegameManager.quickSaveSlot, true, true); } + return true; }); M_ActivateMenu(newmenu); @@ -716,6 +717,7 @@ CCMD(quickload) { savegameManager.LoadGame(savegameManager.quickSaveSlot); } + return true; }); M_ActivateMenu(newmenu); }