From 5261acce1d519bf6a1d9b0bd080e6e1b1494e37d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 9 Feb 2016 17:55:43 +0100 Subject: [PATCH] - undid incorrect part of CheckClass fix. --- src/thingdef/thingdef_expression.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index b86c690f57..0038bc337b 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -52,6 +52,7 @@ #include "thingdef_exp.h" #include "m_fixed.h" #include "vmbuilder.h" +#include "v_text.h" ExpEmit::ExpEmit(VMFunctionBuilder *build, int type) : RegNum(build->Registers[type].Get(1)), RegType(type), Konst(false), Fixed(false) @@ -3546,15 +3547,25 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx) if (clsname != NAME_None) { - // for backwards compatibility with old times it cannot be made a fatal error, if the class is not defined. :( - cls = desttype->FindClassTentative(clsname, false); - if (!cls->IsDescendantOf(desttype)) + cls = PClass::FindClass(clsname); + if (cls == NULL) { - ScriptPosition.Message(MSG_ERROR,"class '%s' is not compatible with '%s'", clsname.GetChars(), desttype->TypeName.GetChars()); - delete this; - return NULL; + /* lax */ + // Since this happens in released WADs it must pass without a terminal error... :( + ScriptPosition.Message(MSG_WARNING, + "Unknown class name '%s'", + clsname.GetChars(), desttype->TypeName.GetChars()); } - ScriptPosition.Message(MSG_DEBUG,"resolving '%s' as class name", clsname.GetChars()); + else + { + if (!cls->IsDescendantOf(desttype)) + { + ScriptPosition.Message(MSG_ERROR, "class '%s' is not compatible with '%s'", clsname.GetChars(), desttype->TypeName.GetChars()); + delete this; + return NULL; + } + } + ScriptPosition.Message(MSG_DEBUG, "resolving '%s' as class name", clsname.GetChars()); } FxExpression *x = new FxConstant(cls, ScriptPosition); delete this;