From 5754812dea6598335f60858d125639c92ec67914 Mon Sep 17 00:00:00 2001 From: oy Date: Mon, 11 Oct 2010 00:30:56 +0200 Subject: [PATCH] clear history of the remote console on disconnect and cleaned up some old stuff in console.cpp --- src/game/client/components/console.cpp | 43 ++++++-------------------- src/game/client/components/console.h | 2 ++ 2 files changed, 11 insertions(+), 34 deletions(-) diff --git a/src/game/client/components/console.cpp b/src/game/client/components/console.cpp index 9808a99f7..b99137c27 100644 --- a/src/game/client/components/console.cpp +++ b/src/game/client/components/console.cpp @@ -1,4 +1,3 @@ -//#include "gc_console.h" #include #include @@ -38,10 +37,6 @@ enum 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_Type = Type; @@ -69,6 +64,12 @@ void CGameConsole::CInstance::ClearBacklog() m_BacklogActPage = 0; } +void CGameConsole::CInstance::ClearHistory() +{ + m_History.Init(); + m_pHistoryEntry = 0; +} + void CGameConsole::CInstance::ExecuteLine(const char *pLine) { if(m_Type == 0) @@ -673,34 +674,8 @@ void CGameConsole::OnConsoleInit() Console()->Register("dump_remote_console", "", CFGFLAG_CLIENT, ConDumpRemoteConsole, this, "Dump remote console"); } -/* -static void con_team(void *result, void *user_data) +void CGameConsole::OnStateChange(int NewState, int OldState) { - 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); -} -*/ diff --git a/src/game/client/components/console.h b/src/game/client/components/console.h index a4d227902..ae05aa8ba 100644 --- a/src/game/client/components/console.h +++ b/src/game/client/components/console.h @@ -32,6 +32,7 @@ class CGameConsole : public CComponent void Init(CGameConsole *pGameConsole); void ClearBacklog(); + void ClearHistory(); void ExecuteLine(const char *pLine); @@ -72,6 +73,7 @@ public: void PrintLine(int Type, const char *pLine); + virtual void OnStateChange(int NewState, int OldState); virtual void OnConsoleInit(); virtual void OnReset(); virtual void OnRender();