Fix server compile failure: script module binding + LogLevel name clash
Root causes from the script log of a failed boot: - config.cpp bound the 4_World scripts to BOTH gameScriptModule and worldScriptModule. Compiling 4_World code inside 3_Game made PlayerBase, Container_Base, ActionContinuousBase and ActionData unknown types, which cascaded to YALootBoxes_Base and aborted the Game module. Now bound to worldScriptModule only. - Static YALB_ConfigLoader.LogLevel collided with a framework type named LogLevel (CommunityFramework/DabsFramework). Renamed to ActiveLogLevel. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
4b59c8e34b
commit
663db39ab6
2 changed files with 11 additions and 9 deletions
10
config.cpp
10
config.cpp
|
|
@ -34,11 +34,11 @@ class CfgMods
|
|||
|
||||
class defs
|
||||
{
|
||||
class gameScriptModule
|
||||
{
|
||||
value = "";
|
||||
files[] = { "YALootBoxes/scripts/4_World" };
|
||||
};
|
||||
// 4_World code (PlayerBase, Container_Base, ActionContinuousBase,
|
||||
// ActionData, etc.) must load ONLY into the World script module.
|
||||
// Binding it to gameScriptModule too forces it to compile inside
|
||||
// 3_Game - where those World types don't exist yet - which is what
|
||||
// produced all the "Unknown type" errors and aborted the server.
|
||||
class worldScriptModule
|
||||
{
|
||||
value = "";
|
||||
|
|
|
|||
|
|
@ -186,7 +186,9 @@ class YALB_ConfigLoader
|
|||
|
||||
// Parsed-once numeric mirror of MainConfig.DebugLogLevel (see YALB_LogLevel).
|
||||
// Defaults to INFO so logging behaves sanely before LoadAll() runs.
|
||||
static int LogLevel = YALB_LogLevel.INFO;
|
||||
// NB: named ActiveLogLevel, not LogLevel - a loaded framework
|
||||
// (CommunityFramework/DabsFramework) already defines a type 'LogLevel'.
|
||||
static int ActiveLogLevel = YALB_LogLevel.INFO;
|
||||
|
||||
static void EnsureDirectoryExists()
|
||||
{
|
||||
|
|
@ -212,7 +214,7 @@ class YALB_ConfigLoader
|
|||
}
|
||||
|
||||
// Parse the configured level NOW so every log below honours it.
|
||||
LogLevel = YALB_ParseLogLevel(MainConfig.DebugLogLevel);
|
||||
ActiveLogLevel = YALB_ParseLogLevel(MainConfig.DebugLogLevel);
|
||||
|
||||
if (!mainConfigExisted)
|
||||
Log_Info("main_config.json not found - created with defaults.");
|
||||
|
|
@ -322,7 +324,7 @@ int YALB_ParseLogLevel(string raw)
|
|||
// Shared gate + format for the non-error levels.
|
||||
void YALB_Emit(int level, string tag, string msg)
|
||||
{
|
||||
if (YALB_ConfigLoader.LogLevel < level)
|
||||
if (YALB_ConfigLoader.ActiveLogLevel < level)
|
||||
return;
|
||||
Print("[YALootBoxes][" + tag + "] " + msg);
|
||||
}
|
||||
|
|
@ -331,7 +333,7 @@ void YALB_Emit(int level, string tag, string msg)
|
|||
// addition to honouring the level gate. (ErrorEx is standard DayZ API.)
|
||||
void Log_Error(string msg)
|
||||
{
|
||||
if (YALB_ConfigLoader.LogLevel < YALB_LogLevel.ERROR)
|
||||
if (YALB_ConfigLoader.ActiveLogLevel < YALB_LogLevel.ERROR)
|
||||
return;
|
||||
ErrorEx("[YALootBoxes][ERROR] " + msg);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue