clear history of the remote console on disconnect and cleaned up some old stuff in console.cpp

This commit is contained in:
oy 2010-10-11 00:30:56 +02:00
parent 00c1421034
commit 5754812dea
2 changed files with 11 additions and 34 deletions

View file

@ -1,4 +1,3 @@
//#include "gc_console.h"
#include <math.h> #include <math.h>
#include <time.h> #include <time.h>
@ -38,10 +37,6 @@ enum
CGameConsole::CInstance::CInstance(int Type) CGameConsole::CInstance::CInstance(int Type)
{ {
// init ringbuffers
//history = ringbuf_init(history_data, sizeof(history_data), RINGBUF_FLAG_RECYCLE);
//backlog = ringbuf_init(backlog_data, sizeof(backlog_data), RINGBUF_FLAG_RECYCLE);
m_pHistoryEntry = 0x0; m_pHistoryEntry = 0x0;
m_Type = Type; m_Type = Type;
@ -69,6 +64,12 @@ void CGameConsole::CInstance::ClearBacklog()
m_BacklogActPage = 0; m_BacklogActPage = 0;
} }
void CGameConsole::CInstance::ClearHistory()
{
m_History.Init();
m_pHistoryEntry = 0;
}
void CGameConsole::CInstance::ExecuteLine(const char *pLine) void CGameConsole::CInstance::ExecuteLine(const char *pLine)
{ {
if(m_Type == 0) if(m_Type == 0)
@ -673,34 +674,8 @@ void CGameConsole::OnConsoleInit()
Console()->Register("dump_remote_console", "", CFGFLAG_CLIENT, ConDumpRemoteConsole, this, "Dump remote console"); Console()->Register("dump_remote_console", "", CFGFLAG_CLIENT, ConDumpRemoteConsole, this, "Dump remote console");
} }
/* void CGameConsole::OnStateChange(int NewState, int OldState)
static void con_team(void *result, void *user_data)
{ {
send_switch_team(console_arg_int(result, 0)); if(NewState == IClient::STATE_OFFLINE)
m_RemoteConsole.ClearHistory();
} }
static void con_kill(void *result, void *user_data)
{
send_kill(-1);
}
void send_kill(int client_id);
static void con_emote(void *result, void *user_data)
{
send_emoticon(console_arg_int(result, 0));
}
extern void con_chat(void *result, void *user_data);
void client_console_init()
{
//
MACRO_REGISTER_COMMAND("team", "i", con_team, 0x0);
MACRO_REGISTER_COMMAND("kill", "", con_kill, 0x0);
// chatting
MACRO_REGISTER_COMMAND("emote", "i", con_emote, 0);
MACRO_REGISTER_COMMAND("+emote", "", con_key_input_state, &emoticon_selector_active);
}
*/

View file

@ -32,6 +32,7 @@ class CGameConsole : public CComponent
void Init(CGameConsole *pGameConsole); void Init(CGameConsole *pGameConsole);
void ClearBacklog(); void ClearBacklog();
void ClearHistory();
void ExecuteLine(const char *pLine); void ExecuteLine(const char *pLine);
@ -72,6 +73,7 @@ public:
void PrintLine(int Type, const char *pLine); void PrintLine(int Type, const char *pLine);
virtual void OnStateChange(int NewState, int OldState);
virtual void OnConsoleInit(); virtual void OnConsoleInit();
virtual void OnReset(); virtual void OnReset();
virtual void OnRender(); virtual void OnRender();