mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Squirrel: fix color logging bug
Fix defect where color logging for script error/warnings did not work for the in-game console, when color logging for external console was disabled. This is the only reported SDK defect after 15K downloads!
This commit is contained in:
parent
b6ff2c8798
commit
a9613347c6
@ -108,8 +108,26 @@ SQRESULT SQVM_PrintFunc(HSQUIRRELVM v, SQChar* fmt, ...)
|
||||
|
||||
if (sq_showvmoutput->GetInt() > 1 || bLogLevelOverride)
|
||||
{
|
||||
bool bError = false;
|
||||
bool bColorOverride = false;
|
||||
bool bError = false;
|
||||
|
||||
if (g_bSQAuxError)
|
||||
{
|
||||
bColorOverride = true;
|
||||
if (strstr(buf, "SCRIPT ERROR:") || strstr(buf, " -> ")) {
|
||||
bError = true;
|
||||
}
|
||||
}
|
||||
else if (g_bSQAuxBadLogic)
|
||||
{
|
||||
if (strstr(buf, "There was a problem processing game logic."))
|
||||
{
|
||||
bColorOverride = true;
|
||||
bError = true;
|
||||
g_bSQAuxBadLogic = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!g_bSpdLog_UseAnsiClr)
|
||||
{
|
||||
wconsole->debug(vmStr);
|
||||
@ -117,15 +135,13 @@ SQRESULT SQVM_PrintFunc(HSQUIRRELVM v, SQChar* fmt, ...)
|
||||
RCONServer()->Send(vmStr, "", sv_rcon::response_t::SERVERDATA_RESPONSE_CONSOLE_LOG, nResponseId);
|
||||
#endif // DEDICATED
|
||||
}
|
||||
else
|
||||
else // Use ANSI escape codes for the external console.
|
||||
{
|
||||
static std::string vmStrAnsi;
|
||||
if (g_bSQAuxError)
|
||||
if (bColorOverride)
|
||||
{
|
||||
bColorOverride = true;
|
||||
if (strstr(buf, "SCRIPT ERROR:") || strstr(buf, " -> "))
|
||||
if (bError)
|
||||
{
|
||||
bError = true;
|
||||
vmStrAnsi = Plat_GetProcessUpTime();
|
||||
vmStrAnsi.append(SQVM_ERROR_ANSI_LOG_T[static_cast<SQInteger>(context)]);
|
||||
}
|
||||
@ -135,23 +151,6 @@ SQRESULT SQVM_PrintFunc(HSQUIRRELVM v, SQChar* fmt, ...)
|
||||
vmStrAnsi.append(SQVM_WARNING_ANSI_LOG_T[static_cast<SQInteger>(context)]);
|
||||
}
|
||||
}
|
||||
else if (g_bSQAuxBadLogic)
|
||||
{
|
||||
if (strstr(buf, "There was a problem processing game logic."))
|
||||
{
|
||||
bError = true;
|
||||
bColorOverride = true;
|
||||
g_bSQAuxBadLogic = false;
|
||||
|
||||
vmStrAnsi = Plat_GetProcessUpTime();
|
||||
vmStrAnsi.append(SQVM_ERROR_ANSI_LOG_T[static_cast<SQInteger>(context)]);
|
||||
}
|
||||
else
|
||||
{
|
||||
vmStrAnsi = Plat_GetProcessUpTime();
|
||||
vmStrAnsi.append(SQVM_ANSI_LOG_T[static_cast<SQInteger>(context)]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vmStrAnsi = Plat_GetProcessUpTime();
|
||||
|
Loading…
x
Reference in New Issue
Block a user