- fixed the item check in OptionMenuItemCommand.

This was calling the wrong GetItem function.
This commit is contained in:
Christoph Oelckers 2017-02-14 16:50:10 +01:00
parent 443ac50887
commit 7b1645d239
3 changed files with 9 additions and 3 deletions

View file

@ -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()

View file

@ -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)

View file

@ -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;