| 409 | } |
| 410 | |
| 411 | void CGameConsole::CInstance::ExecuteLine(const char *pLine) |
| 412 | { |
| 413 | if(m_Type == CONSOLETYPE_LOCAL || m_pGameConsole->Client()->RconAuthed()) |
| 414 | { |
| 415 | const char *pPrevEntry = m_History.Last(); |
| 416 | if(pPrevEntry == nullptr || str_comp(pPrevEntry, pLine) != 0) |
| 417 | { |
| 418 | const size_t Size = str_length(pLine) + 1; |
| 419 | char *pEntry = m_History.Allocate(Size); |
| 420 | str_copy(pEntry, pLine, Size); |
| 421 | } |
| 422 | // print out the user's commands before they get run |
| 423 | char aBuf[IConsole::CMDLINE_LENGTH + 3]; |
| 424 | str_format(aBuf, sizeof(aBuf), "> %s", pLine); |
| 425 | m_pGameConsole->PrintLine(m_Type, aBuf); |
| 426 | } |
| 427 | |
| 428 | if(m_Type == CGameConsole::CONSOLETYPE_LOCAL) |
| 429 | { |
| 430 | m_pGameConsole->m_pConsole->ExecuteLine(pLine, IConsole::CLIENT_ID_UNSPECIFIED); |
| 431 | } |
| 432 | else |
| 433 | { |
| 434 | if(m_pGameConsole->Client()->RconAuthed()) |
| 435 | { |
| 436 | m_pGameConsole->Client()->Rcon(pLine); |
| 437 | } |
| 438 | else |
| 439 | { |
| 440 | if(!m_UserGot && m_UsernameReq) |
| 441 | { |
| 442 | m_UserGot = true; |
| 443 | str_copy(m_aUser, pLine); |
| 444 | } |
| 445 | else |
| 446 | { |
| 447 | m_pGameConsole->Client()->RconAuth(m_aUser, pLine, g_Config.m_ClDummy); |
| 448 | m_UserGot = false; |
| 449 | } |
| 450 | } |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | void CGameConsole::CInstance::PossibleCommandsCompleteCallback(int Index, const char *pStr, void *pUser) |
| 455 | { |
no test coverage detected