mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Check and clear console vector even if console is not drawn
The vector could still overflow if user plays the game for a long time while not opening the console at least once.
This commit is contained in:
parent
f909635526
commit
d182652211
@ -10,6 +10,7 @@
|
||||
#include "engine/net_chan.h"
|
||||
#include "public/include/bansystem.h"
|
||||
#include "vpc/keyvalues.h"
|
||||
#include "gameui/IConsole.h"
|
||||
/*****************************************************************************/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -97,7 +98,7 @@ void __fastcall HFrameStageNotify(CHLClient* rcx, ClientFrameStage_t frameStage)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_pIConsole->Think();
|
||||
CHLClient_FrameStageNotify(rcx, (int)frameStage);
|
||||
}
|
||||
|
||||
|
@ -60,18 +60,6 @@ void CConsole::Draw(const char* pszTitle, bool* bDraw)
|
||||
SetStyleVar();
|
||||
m_bInitialized = true;
|
||||
}
|
||||
if (g_pImGuiConfig->IConsole_Config.m_bAutoClear) // Check if Auto-Clear is enabled.
|
||||
{
|
||||
// Loop and clear the beginning of the vector until we are below our limit.
|
||||
while (m_ivConLog.Size > g_pImGuiConfig->IConsole_Config.m_nAutoClearLimit)
|
||||
{
|
||||
m_ivConLog.erase(m_ivConLog.begin());
|
||||
}
|
||||
while (m_ivHistory.Size > 512)
|
||||
{
|
||||
m_ivHistory.erase(m_ivHistory.begin());
|
||||
}
|
||||
}
|
||||
|
||||
//ImGui::ShowStyleEditor();
|
||||
|
||||
@ -214,6 +202,25 @@ void CConsole::Options()
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: runs tasks for the console while not being drawn
|
||||
//-----------------------------------------------------------------------------
|
||||
void CConsole::Think()
|
||||
{
|
||||
if (g_pImGuiConfig->IConsole_Config.m_bAutoClear) // Check if Auto-Clear is enabled.
|
||||
{
|
||||
// Loop and clear the beginning of the vector until we are below our limit.
|
||||
while (m_ivConLog.Size > g_pImGuiConfig->IConsole_Config.m_nAutoClearLimit)
|
||||
{
|
||||
m_ivConLog.erase(m_ivConLog.begin());
|
||||
}
|
||||
while (m_ivHistory.Size > 512)
|
||||
{
|
||||
m_ivHistory.erase(m_ivHistory.begin());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: executes submitted commands in a separate thread
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -25,6 +25,7 @@ public:
|
||||
|
||||
void Draw(const char* title, bool* bDraw);
|
||||
void Options();
|
||||
void Think();
|
||||
|
||||
void ProcessCommand(const char* command_line);
|
||||
int TextEditCallback(ImGuiInputTextCallbackData* data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user