Skip to content

Commit

Permalink
Merge pull request ddnet#9399 from ChillerDragon/pr_magic_chat_nums
Browse files Browse the repository at this point in the history
Replace magic numbers with compile time string length
  • Loading branch information
def- authored Dec 18, 2024
2 parents 3d1c090 + d7ae3a3 commit fc44823
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/game/server/gamecontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2179,25 +2179,25 @@ void CGameContext::OnSayNetMessage(const CNetMsg_Cl_Say *pMsg, int ClientId, con
if(str_startswith_nocase(pMsg->m_pMessage + 1, "w "))
{
char aWhisperMsg[256];
str_copy(aWhisperMsg, pMsg->m_pMessage + 3);
str_copy(aWhisperMsg, pMsg->m_pMessage + sizeof("w "));
Whisper(pPlayer->GetCid(), aWhisperMsg);
}
else if(str_startswith_nocase(pMsg->m_pMessage + 1, "whisper "))
{
char aWhisperMsg[256];
str_copy(aWhisperMsg, pMsg->m_pMessage + 9);
str_copy(aWhisperMsg, pMsg->m_pMessage + sizeof("whisper "));
Whisper(pPlayer->GetCid(), aWhisperMsg);
}
else if(str_startswith_nocase(pMsg->m_pMessage + 1, "c "))
{
char aWhisperMsg[256];
str_copy(aWhisperMsg, pMsg->m_pMessage + 3);
str_copy(aWhisperMsg, pMsg->m_pMessage + sizeof("c "));
Converse(pPlayer->GetCid(), aWhisperMsg);
}
else if(str_startswith_nocase(pMsg->m_pMessage + 1, "converse "))
{
char aWhisperMsg[256];
str_copy(aWhisperMsg, pMsg->m_pMessage + 10);
str_copy(aWhisperMsg, pMsg->m_pMessage + sizeof("converse "));
Converse(pPlayer->GetCid(), aWhisperMsg);
}
else
Expand Down

0 comments on commit fc44823

Please sign in to comment.