- allow menu items to inherit their parent's Init method for MENUDEFS.

This commit is contained in:
Christoph Oelckers 2017-02-19 18:15:40 +01:00
parent 68b47d81de
commit 6c9558459d

View file

@ -369,7 +369,7 @@ static void ParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc)
PClass *cls = PClass::FindClass(buildname); PClass *cls = PClass::FindClass(buildname);
if (cls != nullptr && cls->IsDescendantOf("ListMenuItem")) if (cls != nullptr && cls->IsDescendantOf("ListMenuItem"))
{ {
auto func = dyn_cast<PFunction>(cls->Symbols.FindSymbol("Init", false)); auto func = dyn_cast<PFunction>(cls->Symbols.FindSymbol("Init", true));
if (func != nullptr && !(func->Variants[0].Flags & (VARF_Protected | VARF_Private))) // skip internal classes which have a protexted init method. if (func != nullptr && !(func->Variants[0].Flags & (VARF_Protected | VARF_Private))) // skip internal classes which have a protexted init method.
{ {
auto &args = func->Variants[0].Proto->ArgumentTypes; auto &args = func->Variants[0].Proto->ArgumentTypes;
@ -741,7 +741,7 @@ static void ParseOptionMenuBody(FScanner &sc, DOptionMenuDescriptor *desc)
PClass *cls = PClass::FindClass(buildname); PClass *cls = PClass::FindClass(buildname);
if (cls != nullptr && cls->IsDescendantOf("OptionMenuItem")) if (cls != nullptr && cls->IsDescendantOf("OptionMenuItem"))
{ {
auto func = dyn_cast<PFunction>(cls->Symbols.FindSymbol("Init", false)); auto func = dyn_cast<PFunction>(cls->Symbols.FindSymbol("Init", true));
if (func != nullptr && !(func->Variants[0].Flags & (VARF_Protected | VARF_Private))) // skip internal classes which have a protexted init method. if (func != nullptr && !(func->Variants[0].Flags & (VARF_Protected | VARF_Private))) // skip internal classes which have a protexted init method.
{ {
auto &args = func->Variants[0].Proto->ArgumentTypes; auto &args = func->Variants[0].Proto->ArgumentTypes;