From 7b1645d239808515a44f3d438474561d97d1983c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 14 Feb 2017 16:50:10 +0100 Subject: [PATCH] - fixed the item check in OptionMenuItemCommand. This was calling the wrong GetItem function. --- src/menu/menu.cpp | 6 ++++++ wadsrc/static/zscript/menu/optionmenu.txt | 2 +- wadsrc/static/zscript/menu/optionmenuitems.txt | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index 25506a877a..9d8e5f4f3c 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -448,6 +448,12 @@ DEFINE_ACTION_FUNCTION(DMenu, GetItem) ACTION_RETURN_OBJECT(self->GetItem(name)); } +DEFINE_ACTION_FUNCTION(DOptionMenuDescriptor, GetItem) +{ + PARAM_SELF_PROLOGUE(DOptionMenuDescriptor); + PARAM_NAME(name); + ACTION_RETURN_OBJECT(self->GetItem(name)); +} bool DMenu::DimAllowed() diff --git a/wadsrc/static/zscript/menu/optionmenu.txt b/wadsrc/static/zscript/menu/optionmenu.txt index 5e5b888b1e..9eb26ac86f 100644 --- a/wadsrc/static/zscript/menu/optionmenu.txt +++ b/wadsrc/static/zscript/menu/optionmenu.txt @@ -57,7 +57,7 @@ class OptionMenuDescriptor : MenuDescriptor native native bool mDontDim; native void CalcIndent(); - //native OptionMenuItem GetItem(Name iname); + native OptionMenuItem GetItem(Name iname); void Reset() { // Reset the default settings (ignore all other values in the struct) diff --git a/wadsrc/static/zscript/menu/optionmenuitems.txt b/wadsrc/static/zscript/menu/optionmenuitems.txt index 03aac8f613..d21c4ba66f 100644 --- a/wadsrc/static/zscript/menu/optionmenuitems.txt +++ b/wadsrc/static/zscript/menu/optionmenuitems.txt @@ -132,11 +132,11 @@ class OptionMenuItemCommand : OptionMenuItemSubmenu override bool Activate() { // This needs to perform a few checks to prevent abuse by malicious modders. - let m = Menu.GetCurrentMenu(); + let m = OptionMenu(Menu.GetCurrentMenu()); // don't execute if no menu is active if (m == null) return false; // don't execute if this item cannot be found in the current menu. - if (m.GetItem(mAction) != self) return false; + if (m.mDesc.GetItem(mAction) != self) return false; Menu.MenuSound("menu/choose"); DoCommand(mAction); return true;