Skip to content

Commit

Permalink
remove "DECORATE" from error string
Browse files Browse the repository at this point in the history
* print warning count as well
* allow treating warnings as errors
  • Loading branch information
RicardoLuis0 committed Dec 13, 2024
1 parent 325817a commit e82c7d2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/common/scripting/backend/vmbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "filesystem.h"

CVAR(Bool, strictdecorate, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
CVAR(Bool, warningstoerrors, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)

EXTERN_CVAR(Bool, vm_jit)
EXTERN_CVAR(Bool, vm_jit_aot)
Expand Down
22 changes: 21 additions & 1 deletion src/scripting/thingdef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ static TMap<FState *, FScriptPosition> StateSourceLines;
static FScriptPosition unknownstatesource("unknown file", 0);

EXTERN_CVAR(Bool, strictdecorate);
EXTERN_CVAR(Bool, warningstoerrors);

//==========================================================================
//
Expand Down Expand Up @@ -464,8 +465,27 @@ void LoadActors()

if (FScriptPosition::ErrorCounter > 0)
{
I_Error("%d errors while parsing DECORATE scripts", FScriptPosition::ErrorCounter);
if (FScriptPosition::WarnCounter > 0)
{
I_Error("%d errors, %d warnings while parsing scripts", FScriptPosition::ErrorCounter, FScriptPosition::WarnCounter);
}
else
{
I_Error("%d errors while parsing scripts", FScriptPosition::ErrorCounter);
}
}
else if (FScriptPosition::WarnCounter > 0)
{
if(warningstoerrors)
{
I_Error("%d warnings while parsing scripts\n", FScriptPosition::WarnCounter);
}
else
{
Printf(TEXTCOLOR_ORANGE "%d warnings while parsing scripts\n", FScriptPosition::WarnCounter);
}
}

FScriptPosition::ResetErrorCounter();
// AllActorClasses hasn'T been set up yet.
for (int i = PClass::AllClasses.Size() - 1; i >= 0; i--)
Expand Down

0 comments on commit e82c7d2

Please sign in to comment.