MCPcopy Create free account
hub / github.com/ddnet/ddnet / ExecuteLine

Method ExecuteLine

src/game/client/components/console.cpp:411–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

409}
410
411void 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
454void CGameConsole::CInstance::PossibleCommandsCompleteCallback(int Index, const char *pStr, void *pUser)
455{

Callers 9

LoadMapSettingsMethod · 0.45
OnActivateMethod · 0.45
RenderMethod · 0.45
RenderGameMethod · 0.45
OnTickMethod · 0.45
PreProcessMsgMethod · 0.45
OnSayNetMessageMethod · 0.45
ConForceVoteMethod · 0.45
LoadMapSettingsMethod · 0.45

Calls 11

str_compFunction · 0.85
str_lengthFunction · 0.85
str_formatFunction · 0.85
RconAuthedMethod · 0.80
PrintLineMethod · 0.80
RconMethod · 0.80
RconAuthMethod · 0.80
str_copyFunction · 0.50
ClientMethod · 0.45
LastMethod · 0.45
AllocateMethod · 0.45

Tested by

no test coverage detected