mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- added 'strictdecorate' CVAR. If this is set to 'true', any DECORATE error that had to be demoted to a warning for backwards compatibility will be treated as an actual error.
This commit is contained in:
parent
cf21bb1524
commit
ef86b3975a
5 changed files with 17 additions and 8 deletions
|
@ -60,6 +60,7 @@
|
|||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||
|
||||
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
||||
EXTERN_CVAR(Bool, strictdecorate);
|
||||
|
||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||
|
||||
|
@ -3067,7 +3068,8 @@ void PClass::InsertIntoHash ()
|
|||
if (found != NULL)
|
||||
{ // This type has already been inserted
|
||||
// ... but there is no need whatsoever to make it a fatal error!
|
||||
Printf (TEXTCOLOR_RED"Tried to register class '%s' more than once.\n", TypeName.GetChars());
|
||||
if (!strictdecorate) Printf (TEXTCOLOR_RED"Tried to register class '%s' more than once.\n", TypeName.GetChars());
|
||||
else I_Error("Tried to register class '%s' more than once.\n", TypeName.GetChars());
|
||||
TypeTable.ReplaceType(this, found, bucket);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1038,11 +1038,17 @@ FScriptPosition &FScriptPosition::operator=(const FScriptPosition &other)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
CVAR(Bool, strictdecorate, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
|
||||
|
||||
void FScriptPosition::Message (int severity, const char *message, ...) const
|
||||
{
|
||||
FString composed;
|
||||
|
||||
if ((severity == MSG_DEBUG || severity == MSG_DEBUGLOG) && !developer) return;
|
||||
if (severity == MSG_OPTERROR)
|
||||
{
|
||||
severity = strictdecorate ? MSG_ERROR : MSG_WARNING;
|
||||
}
|
||||
|
||||
if (message == NULL)
|
||||
{
|
||||
|
|
|
@ -124,6 +124,7 @@ enum
|
|||
MSG_WARNING,
|
||||
MSG_FATAL,
|
||||
MSG_ERROR,
|
||||
MSG_OPTERROR,
|
||||
MSG_DEBUG,
|
||||
MSG_LOG,
|
||||
MSG_DEBUGLOG,
|
||||
|
|
|
@ -368,8 +368,8 @@ FxExpression *FxIntCast::Resolve(FCompileContext &ctx)
|
|||
else
|
||||
{
|
||||
// Ugh. This should abort, but too many mods fell into this logic hole somewhere, so this seroious error needs to be reduced to a warning. :(
|
||||
if (!basex->isConstant()) ScriptPosition.Message(MSG_WARNING, "Numeric type expected, got a name");
|
||||
else ScriptPosition.Message(MSG_WARNING, "Numeric type expected, got \"%s\"", static_cast<FxConstant*>(basex)->GetValue().GetName().GetChars());
|
||||
if (!basex->isConstant()) ScriptPosition.Message(MSG_OPTERROR, "Numeric type expected, got a name");
|
||||
else ScriptPosition.Message(MSG_OPTERROR, "Numeric type expected, got \"%s\"", static_cast<FxConstant*>(basex)->GetValue().GetName().GetChars());
|
||||
FxExpression * x = new FxConstant(0, ScriptPosition);
|
||||
delete this;
|
||||
return x;
|
||||
|
@ -466,8 +466,8 @@ FxExpression *FxFloatCast::Resolve(FCompileContext &ctx)
|
|||
else
|
||||
{
|
||||
// Ugh. This should abort, but too many mods fell into this logic hole somewhere, so this seroious error needs to be reduced to a warning. :(
|
||||
if (!basex->isConstant()) ScriptPosition.Message(MSG_WARNING, "Numeric type expected, got a name");
|
||||
else ScriptPosition.Message(MSG_WARNING, "Numeric type expected, got \"%s\"", static_cast<FxConstant*>(basex)->GetValue().GetName().GetChars());
|
||||
if (!basex->isConstant()) ScriptPosition.Message(MSG_OPTERROR, "Numeric type expected, got a name");
|
||||
else ScriptPosition.Message(MSG_OPTERROR, "Numeric type expected, got \"%s\"", static_cast<FxConstant*>(basex)->GetValue().GetName().GetChars());
|
||||
FxExpression *x = new FxConstant(0.0, ScriptPosition);
|
||||
delete this;
|
||||
return x;
|
||||
|
@ -3924,7 +3924,7 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
|
|||
{
|
||||
/* lax */
|
||||
// Since this happens in released WADs it must pass without a terminal error... :(
|
||||
ScriptPosition.Message(MSG_WARNING,
|
||||
ScriptPosition.Message(MSG_OPTERROR,
|
||||
"Unknown class name '%s'",
|
||||
clsname.GetChars(), desttype->TypeName.GetChars());
|
||||
}
|
||||
|
@ -4095,7 +4095,7 @@ FxExpression *FxMultiNameState::Resolve(FCompileContext &ctx)
|
|||
destination = scope->FindState(names.Size()-1, &names[1], false);
|
||||
if (destination == NULL)
|
||||
{
|
||||
ScriptPosition.Message(MSG_WARNING, "Unknown state jump destination");
|
||||
ScriptPosition.Message(MSG_OPTERROR, "Unknown state jump destination");
|
||||
/* lax */
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -457,7 +457,7 @@ DEFINE_PROPERTY(skip_super, 0, Actor)
|
|||
}
|
||||
if (bag.StateSet)
|
||||
{
|
||||
bag.ScriptPosition.Message(MSG_WARNING,
|
||||
bag.ScriptPosition.Message(MSG_OPTERROR,
|
||||
"'skip_super' must appear before any state definitions.");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue