diff options
| author | oy <Tom_Adams@web.de> | 2010-11-17 13:01:46 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2010-11-17 13:01:46 +0100 |
| commit | 8351682edf630d2d1ec706f0cf6406d026c7a8a4 (patch) | |
| tree | a22ae918aec5ce477fb99bfbf371b19e196fdc71 /src | |
| parent | 994a44f6e1b821517d36f0cf20beaaf07cfca4e4 (diff) | |
| download | zcatch-8351682edf630d2d1ec706f0cf6406d026c7a8a4.tar.gz zcatch-8351682edf630d2d1ec706f0cf6406d026c7a8a4.zip | |
added constants for console types by Choupom
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/client/components/console.cpp | 40 | ||||
| -rw-r--r-- | src/game/client/components/console.h | 6 | ||||
| -rw-r--r-- | src/game/client/gameclient.cpp | 2 |
3 files changed, 27 insertions, 21 deletions
diff --git a/src/game/client/components/console.cpp b/src/game/client/components/console.cpp index 3df13cad..420b7884 100644 --- a/src/game/client/components/console.cpp +++ b/src/game/client/components/console.cpp @@ -41,7 +41,7 @@ CGameConsole::CInstance::CInstance(int Type) m_Type = Type; - if(Type == 0) + if(Type == CGameConsole::CONSOLETYPE_LOCAL) m_CompletionFlagmask = CFGFLAG_CLIENT; else m_CompletionFlagmask = CFGFLAG_SERVER; @@ -72,7 +72,7 @@ void CGameConsole::CInstance::ClearHistory() void CGameConsole::CInstance::ExecuteLine(const char *pLine) { - if(m_Type == 0) + if(m_Type == CGameConsole::CONSOLETYPE_LOCAL) m_pGameConsole->m_pConsole->ExecuteLine(pLine); else { @@ -101,7 +101,7 @@ void CGameConsole::CInstance::OnInput(IInput::CEvent Event) { if(m_Input.GetString()[0]) { - if(m_Type != 1 || m_pGameConsole->Client()->RconAuthed()) + if(m_Type == CONSOLETYPE_LOCAL || m_pGameConsole->Client()->RconAuthed()) { char *pEntry = m_History.Allocate(m_Input.GetLength()+1); mem_copy(pEntry, m_Input.GetString(), m_Input.GetLength()+1); @@ -150,7 +150,7 @@ void CGameConsole::CInstance::OnInput(IInput::CEvent Event) } else if(Event.m_Key == KEY_TAB) { - if(m_Type == 0 || m_pGameConsole->Client()->RconAuthed()) + if(m_Type == CGameConsole::CONSOLETYPE_LOCAL || m_pGameConsole->Client()->RconAuthed()) { m_CompletionChosen++; m_CompletionEnumerationCount = 0; @@ -216,9 +216,9 @@ void CGameConsole::CInstance::PrintLine(const char *pLine) } CGameConsole::CGameConsole() -: m_LocalConsole(0), m_RemoteConsole(1) +: m_LocalConsole(CONSOLETYPE_LOCAL), m_RemoteConsole(CONSOLETYPE_REMOTE) { - m_ConsoleType = 0; + m_ConsoleType = CONSOLETYPE_LOCAL; m_ConsoleState = CONSOLE_CLOSED; m_StateChangeEnd = 0.0f; m_StateChangeDuration = 0.1f; @@ -232,7 +232,7 @@ float CGameConsole::TimeNow() CGameConsole::CInstance *CGameConsole::CurrentConsole() { - if(m_ConsoleType != 0) + if(m_ConsoleType == CONSOLETYPE_REMOTE) return &m_RemoteConsole; return &m_LocalConsole; } @@ -324,7 +324,7 @@ void CGameConsole::OnRender() } if (m_ConsoleState == CONSOLE_OPEN && g_Config.m_ClEditor) - Toggle(0); + Toggle(CONSOLETYPE_LOCAL); if (m_ConsoleState == CONSOLE_CLOSED) return; @@ -362,7 +362,7 @@ void CGameConsole::OnRender() Graphics()->TextureSet(g_pData->m_aImages[IMAGE_CONSOLE_BG].m_Id); Graphics()->QuadsBegin(); Graphics()->SetColor(0.2f, 0.2f, 0.2f,0.9f); - if(m_ConsoleType != 0) + if(m_ConsoleType == CONSOLETYPE_REMOTE) Graphics()->SetColor(0.4f, 0.2f, 0.2f,0.9f); Graphics()->QuadsSetSubset(0,-ConsoleHeight*0.075f,Screen.w*0.075f*0.5f,0); QuadItem = IGraphics::CQuadItem(0, 0, Screen.w, ConsoleHeight); @@ -414,7 +414,7 @@ void CGameConsole::OnRender() TextRender()->SetCursor(&Info.m_Cursor, x+Info.m_Offset, y+12.0f, FontSize, TEXTFLAG_RENDER); const char *pPrompt = "> "; - if(m_ConsoleType) + if(m_ConsoleType == CONSOLETYPE_REMOTE) { if(Client()->State() == IClient::STATE_ONLINE) { @@ -445,7 +445,7 @@ void CGameConsole::OnRender() //hide rcon password char aInputString[256]; str_copy(aInputString, pConsole->m_Input.GetString(), sizeof(aInputString)); - if(m_ConsoleType && Client()->State() == IClient::STATE_ONLINE && !Client()->RconAuthed()) + if(m_ConsoleType == CONSOLETYPE_REMOTE && Client()->State() == IClient::STATE_ONLINE && !Client()->RconAuthed()) { for(int i = 0; i < pConsole->m_Input.GetLength(); ++i) aInputString[i] = '*'; @@ -457,7 +457,7 @@ void CGameConsole::OnRender() TextRender()->TextEx(&Cursor, aInputString+pConsole->m_Input.GetCursorOffset(), -1); // render possible commands - if(m_ConsoleType == 0 || Client()->RconAuthed()) + if(m_ConsoleType == CONSOLETYPE_LOCAL || Client()->RconAuthed()) { if(pConsole->m_Input.GetString()[0] != 0) { @@ -589,7 +589,7 @@ void CGameConsole::Toggle(int Type) void CGameConsole::Dump(int Type) { - CInstance *pConsole = Type == 1 ? &m_RemoteConsole : &m_LocalConsole; + CInstance *pConsole = Type == CONSOLETYPE_REMOTE ? &m_RemoteConsole : &m_LocalConsole; char aFilename[128]; time_t Time; char aDate[20]; @@ -601,7 +601,7 @@ void CGameConsole::Dump(int Type) for(int i = 0; i < 10; i++) { IOHANDLE io; - str_format(aFilename, sizeof(aFilename), "dumps/%s_dump%s-%05d.txt", Type==1?"remote_console":"local_console", aDate, i); + str_format(aFilename, sizeof(aFilename), "dumps/%s_dump%s-%05d.txt", Type==CONSOLETYPE_REMOTE?"remote_console":"local_console", aDate, i); io = Storage()->OpenFile(aFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE); if(io) { @@ -624,12 +624,12 @@ void CGameConsole::Dump(int Type) void CGameConsole::ConToggleLocalConsole(IConsole::IResult *pResult, void *pUserData) { - ((CGameConsole *)pUserData)->Toggle(0); + ((CGameConsole *)pUserData)->Toggle(CONSOLETYPE_LOCAL); } void CGameConsole::ConToggleRemoteConsole(IConsole::IResult *pResult, void *pUserData) { - ((CGameConsole *)pUserData)->Toggle(1); + ((CGameConsole *)pUserData)->Toggle(CONSOLETYPE_REMOTE); } void CGameConsole::ConClearLocalConsole(IConsole::IResult *pResult, void *pUserData) @@ -644,12 +644,12 @@ void CGameConsole::ConClearRemoteConsole(IConsole::IResult *pResult, void *pUser void CGameConsole::ConDumpLocalConsole(IConsole::IResult *pResult, void *pUserData) { - ((CGameConsole *)pUserData)->Dump(0); + ((CGameConsole *)pUserData)->Dump(CONSOLETYPE_LOCAL); } void CGameConsole::ConDumpRemoteConsole(IConsole::IResult *pResult, void *pUserData) { - ((CGameConsole *)pUserData)->Dump(1); + ((CGameConsole *)pUserData)->Dump(CONSOLETYPE_REMOTE); } void CGameConsole::ClientConsolePrintCallback(const char *pStr, void *pUserData) @@ -659,9 +659,9 @@ void CGameConsole::ClientConsolePrintCallback(const char *pStr, void *pUserData) void CGameConsole::PrintLine(int Type, const char *pLine) { - if(Type == 0) + if(Type == CONSOLETYPE_LOCAL) m_LocalConsole.PrintLine(pLine); - else if(Type == 1) + else if(Type == CONSOLETYPE_REMOTE) m_RemoteConsole.PrintLine(pLine); } diff --git a/src/game/client/components/console.h b/src/game/client/components/console.h index c126f6d8..40ee082f 100644 --- a/src/game/client/components/console.h +++ b/src/game/client/components/console.h @@ -74,6 +74,12 @@ class CGameConsole : public CComponent static void ConDumpRemoteConsole(IConsole::IResult *pResult, void *pUserData); public: + enum + { + CONSOLETYPE_LOCAL=0, + CONSOLETYPE_REMOTE, + }; + CGameConsole(); void PrintLine(int Type, const char *pLine); diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index cffbf7ae..26de650e 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -586,7 +586,7 @@ void CGameClient::OnEnterGame() {} void CGameClient::OnRconLine(const char *pLine) { - m_pGameConsole->PrintLine(1, pLine); + m_pGameConsole->PrintLine(CGameConsole::CONSOLETYPE_REMOTE, pLine); } void CGameClient::ProcessEvents() |