From 65d82823c78b41cf4667c2432879fb171f8bf26e Mon Sep 17 00:00:00 2001 From: Tracer <43095317+TracerDS@users.noreply.github.com> Date: Sat, 8 Jun 2024 14:39:29 +0200 Subject: [PATCH] Fixed #3439 --- .../logic/lua/CLuaFunctionDefs.Output.cpp | 34 +++++++++---------- .../deathmatch/logic/CScriptDebugging.cpp | 3 +- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Output.cpp b/Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Output.cpp index 11169b0dc87..7ba00b4b26f 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Output.cpp +++ b/Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Output.cpp @@ -127,25 +127,23 @@ int CLuaFunctionDefs::OutputClientDebugString(lua_State* luaVM) CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine(luaVM); if (pLuaMain) { - if (uiLevel == 1) + switch (uiLevel) { - m_pScriptDebugging->LogError(luaVM, "%s", strText.c_str()); - } - else if (uiLevel == 2) - { - m_pScriptDebugging->LogWarning(luaVM, "%s", strText.c_str()); - } - else if (uiLevel == 3) - { - m_pScriptDebugging->LogInformation(luaVM, "%s", strText.c_str()); - } - else if (uiLevel == 4) - { - m_pScriptDebugging->LogCustom(luaVM, ucRed, ucGreen, ucBlue, "%s", strText.c_str()); - } - else if (uiLevel == 0) - { - m_pScriptDebugging->LogDebug(luaVM, ucRed, ucGreen, ucBlue, "%s", strText.c_str()); + case 0: + m_pScriptDebugging->LogDebug(luaVM, ucRed, ucGreen, ucBlue, "%s", strText.c_str()); + break; + case 1: + m_pScriptDebugging->LogError(luaVM, "%s", strText.c_str()); + break; + case 2: + m_pScriptDebugging->LogWarning(luaVM, "%s", strText.c_str()); + break; + case 3: + m_pScriptDebugging->LogInformation(luaVM, "%s", strText.c_str()); + break; + case 4: + m_pScriptDebugging->LogCustom(luaVM, ucRed, ucGreen, ucBlue, "%s", strText.c_str()); + break; } // Success diff --git a/Shared/mods/deathmatch/logic/CScriptDebugging.cpp b/Shared/mods/deathmatch/logic/CScriptDebugging.cpp index 8b66520b1ac..d88b0dce731 100644 --- a/Shared/mods/deathmatch/logic/CScriptDebugging.cpp +++ b/Shared/mods/deathmatch/logic/CScriptDebugging.cpp @@ -62,8 +62,7 @@ void CScriptDebugging::LogCustom(lua_State* luaVM, unsigned char ucRed, unsigned VSNPRINTF(szBuffer, MAX_STRING_LENGTH, szFormat, marker); va_end(marker); - SLuaDebugInfo luaDebugInfo; - LogString("", luaDebugInfo, szBuffer, 0, ucRed, ucGreen, ucBlue); + LogString("", GetLuaDebugInfo(luaVM), szBuffer, 4, ucRed, ucGreen, ucBlue); } void CScriptDebugging::LogDebug(lua_State* luaVM, unsigned char ucRed, unsigned char ucGreen, unsigned char ucBlue, const char* szFormat, ...)