- undid incorrect part of CheckClass fix.

This commit is contained in:
Christoph Oelckers 2016-02-09 17:55:43 +01:00
parent bcfb437302
commit 5261acce1d
1 changed files with 18 additions and 7 deletions

View File

@ -52,6 +52,7 @@
#include "thingdef_exp.h" #include "thingdef_exp.h"
#include "m_fixed.h" #include "m_fixed.h"
#include "vmbuilder.h" #include "vmbuilder.h"
#include "v_text.h"
ExpEmit::ExpEmit(VMFunctionBuilder *build, int type) ExpEmit::ExpEmit(VMFunctionBuilder *build, int type)
: RegNum(build->Registers[type].Get(1)), RegType(type), Konst(false), Fixed(false) : RegNum(build->Registers[type].Get(1)), RegType(type), Konst(false), Fixed(false)
@ -3546,14 +3547,24 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
if (clsname != NAME_None) if (clsname != NAME_None)
{ {
// for backwards compatibility with old times it cannot be made a fatal error, if the class is not defined. :( cls = PClass::FindClass(clsname);
cls = desttype->FindClassTentative(clsname, false); if (cls == 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());
}
else
{
if (!cls->IsDescendantOf(desttype)) if (!cls->IsDescendantOf(desttype))
{ {
ScriptPosition.Message(MSG_ERROR, "class '%s' is not compatible with '%s'", clsname.GetChars(), desttype->TypeName.GetChars()); ScriptPosition.Message(MSG_ERROR, "class '%s' is not compatible with '%s'", clsname.GetChars(), desttype->TypeName.GetChars());
delete this; delete this;
return NULL; return NULL;
} }
}
ScriptPosition.Message(MSG_DEBUG, "resolving '%s' as class name", clsname.GetChars()); ScriptPosition.Message(MSG_DEBUG, "resolving '%s' as class name", clsname.GetChars());
} }
FxExpression *x = new FxConstant(cls, ScriptPosition); FxExpression *x = new FxConstant(cls, ScriptPosition);