From e39250b8c16e9eb9c8d6eb5c4973b4eac78c052d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= Date: Fri, 13 Dec 2024 16:36:00 -0300 Subject: [PATCH] remove "DECORATE" from error string * print warning count as well * allow treating warnings as errors --- src/common/scripting/backend/vmbuilder.cpp | 1 + src/scripting/thingdef.cpp | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/common/scripting/backend/vmbuilder.cpp b/src/common/scripting/backend/vmbuilder.cpp index 5437ca848a5..c9bfc63af86 100644 --- a/src/common/scripting/backend/vmbuilder.cpp +++ b/src/common/scripting/backend/vmbuilder.cpp @@ -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) diff --git a/src/scripting/thingdef.cpp b/src/scripting/thingdef.cpp index 6affab4c361..bdec840f58e 100644 --- a/src/scripting/thingdef.cpp +++ b/src/scripting/thingdef.cpp @@ -65,6 +65,7 @@ static TMap StateSourceLines; static FScriptPosition unknownstatesource("unknown file", 0); EXTERN_CVAR(Bool, strictdecorate); +EXTERN_CVAR(Bool, warningstoerrors); //========================================================================== // @@ -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--)