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