- added an option to FindClassTentative to make eventual failure to declare the missing class non-fatal.

Damn those old mods with broken actor references. Thanks to those FxClassTypeCast may not throw fatal errors.
This commit is contained in:
Christoph Oelckers 2016-02-09 12:26:00 +01:00
commit 6c92525fcd
4 changed files with 32 additions and 24 deletions

View file

@ -3546,23 +3546,13 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
if (clsname != NAME_None)
{
cls = desttype->FindClassTentative(clsname);
if (cls == NULL)
// 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))
{
/* 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))
{
ScriptPosition.Message(MSG_ERROR,"class '%s' is not compatible with '%s'", clsname.GetChars(), desttype->TypeName.GetChars());
delete this;
return NULL;
}
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());
}