mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
Fix show_ips to show regular formatting (fixes #1873)
This commit is contained in:
parent
99b814342c
commit
cb738ffed0
|
@ -98,6 +98,7 @@ public:
|
||||||
|
|
||||||
virtual int RegisterPrintCallback(int OutputLevel, FPrintCallback pfnPrintCallback, void *pUserData) = 0;
|
virtual int RegisterPrintCallback(int OutputLevel, FPrintCallback pfnPrintCallback, void *pUserData) = 0;
|
||||||
virtual void SetPrintOutputLevel(int Index, int OutputLevel) = 0;
|
virtual void SetPrintOutputLevel(int Index, int OutputLevel) = 0;
|
||||||
|
virtual char *Format(char *pBuf, int Size, const char *pFrom, const char *pStr) = 0;
|
||||||
virtual void Print(int Level, const char *pFrom, const char *pStr, bool Highlighted = false) = 0;
|
virtual void Print(int Level, const char *pFrom, const char *pStr, bool Highlighted = false) = 0;
|
||||||
virtual void SetTeeHistorianCommandCallback(FTeeHistorianCommandCallback pfnCallback, void *pUser) = 0;
|
virtual void SetTeeHistorianCommandCallback(FTeeHistorianCommandCallback pfnCallback, void *pUser) = 0;
|
||||||
|
|
||||||
|
|
|
@ -2610,9 +2610,10 @@ void CServer::ConShowIps(IConsole::IResult *pResult, void *pUser)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char aBuf[9];
|
char aStr[9];
|
||||||
str_format(aBuf, sizeof(aBuf), "Value: %d", pServer->m_aClients[pServer->m_RconClientID].m_ShowIps);
|
str_format(aStr, sizeof(aStr), "Value: %d", pServer->m_aClients[pServer->m_RconClientID].m_ShowIps);
|
||||||
pServer->SendRconLine(pServer->m_RconClientID, aBuf);
|
char aBuf[32];
|
||||||
|
pServer->SendRconLine(pServer->m_RconClientID, pServer->Console()->Format(aBuf, sizeof(aBuf), "server", aStr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,18 +304,24 @@ void CConsole::SetPrintOutputLevel(int Index, int OutputLevel)
|
||||||
m_aPrintCB[Index].m_OutputLevel = clamp(OutputLevel, (int)(OUTPUT_LEVEL_STANDARD), (int)(OUTPUT_LEVEL_DEBUG));
|
m_aPrintCB[Index].m_OutputLevel = clamp(OutputLevel, (int)(OUTPUT_LEVEL_STANDARD), (int)(OUTPUT_LEVEL_DEBUG));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConsole::Print(int Level, const char *pFrom, const char *pStr, bool Highlighted)
|
char *CConsole::Format(char *pBuf, int Size, const char *pFrom, const char *pStr)
|
||||||
{
|
|
||||||
dbg_msg(pFrom ,"%s", pStr);
|
|
||||||
for(int i = 0; i < m_NumPrintCB; ++i)
|
|
||||||
{
|
|
||||||
if(Level <= m_aPrintCB[i].m_OutputLevel && m_aPrintCB[i].m_pfnPrintCallback)
|
|
||||||
{
|
{
|
||||||
char aTimeBuf[80];
|
char aTimeBuf[80];
|
||||||
str_timestamp_format(aTimeBuf, sizeof(aTimeBuf), FORMAT_TIME);
|
str_timestamp_format(aTimeBuf, sizeof(aTimeBuf), FORMAT_TIME);
|
||||||
|
|
||||||
|
str_format(pBuf, Size, "[%s][%s]: %s", aTimeBuf, pFrom, pStr);
|
||||||
|
return pBuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConsole::Print(int Level, const char *pFrom, const char *pStr, bool Highlighted)
|
||||||
|
{
|
||||||
|
dbg_msg(pFrom ,"%s", pStr);
|
||||||
char aBuf[1024];
|
char aBuf[1024];
|
||||||
str_format(aBuf, sizeof(aBuf), "[%s][%s]: %s", aTimeBuf, pFrom, pStr);
|
Format(aBuf, sizeof(aBuf), pFrom, pStr);
|
||||||
|
for(int i = 0; i < m_NumPrintCB; ++i)
|
||||||
|
{
|
||||||
|
if(Level <= m_aPrintCB[i].m_OutputLevel && m_aPrintCB[i].m_pfnPrintCallback)
|
||||||
|
{
|
||||||
m_aPrintCB[i].m_pfnPrintCallback(aBuf, m_aPrintCB[i].m_pPrintCallbackUserdata, Highlighted);
|
m_aPrintCB[i].m_pfnPrintCallback(aBuf, m_aPrintCB[i].m_pPrintCallbackUserdata, Highlighted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,6 +206,7 @@ public:
|
||||||
|
|
||||||
virtual int RegisterPrintCallback(int OutputLevel, FPrintCallback pfnPrintCallback, void *pUserData);
|
virtual int RegisterPrintCallback(int OutputLevel, FPrintCallback pfnPrintCallback, void *pUserData);
|
||||||
virtual void SetPrintOutputLevel(int Index, int OutputLevel);
|
virtual void SetPrintOutputLevel(int Index, int OutputLevel);
|
||||||
|
virtual char *Format(char *pBuf, int Size, const char *pFrom, const char *pStr);
|
||||||
virtual void Print(int Level, const char *pFrom, const char *pStr, bool Highlighted = false);
|
virtual void Print(int Level, const char *pFrom, const char *pStr, bool Highlighted = false);
|
||||||
virtual void SetTeeHistorianCommandCallback(FTeeHistorianCommandCallback pfnCallback, void *pUser);
|
virtual void SetTeeHistorianCommandCallback(FTeeHistorianCommandCallback pfnCallback, void *pUser);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue