Skip to content

Commit

Permalink
Added ids to names in the gui, removed ascii name restriction and fix…
Browse files Browse the repository at this point in the history
…ed kick/spectate vote description
  • Loading branch information
oy committed Jun 26, 2016
1 parent d6f3cc1 commit 85b4cfd
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 111 deletions.
2 changes: 2 additions & 0 deletions datasrc/network.py
Expand Up @@ -335,11 +335,13 @@
## Demo messages
NetMessage("De_ClientEnter", [
NetStringStrict("m_pName"),
NetIntRange("m_ClientID", -1, 'MAX_CLIENTS-1'),
NetIntRange("m_Team", 'TEAM_SPECTATORS', 'TEAM_BLUE'),
]),

NetMessage("De_ClientLeave", [
NetStringStrict("m_pName"),
NetIntRange("m_ClientID", -1, 'MAX_CLIENTS-1'),
NetStringStrict("m_pReason"),
]),

Expand Down
63 changes: 2 additions & 61 deletions src/engine/server/server.cpp
Expand Up @@ -292,71 +292,12 @@ CServer::CServer() : m_DemoRecorder(&m_SnapshotDelta)
}


int CServer::TrySetClientName(int ClientID, const char *pName)
{
char aTrimmedName[64];

// trim the name
str_copy(aTrimmedName, StrLtrim(pName), sizeof(aTrimmedName));
StrRtrim(aTrimmedName);

// check for empty names
if(!aTrimmedName[0])
return -1;

// check if new and old name are the same
if(m_aClients[ClientID].m_aName[0] && str_comp(m_aClients[ClientID].m_aName, aTrimmedName) == 0)
return 0;

char aBuf[256];
str_format(aBuf, sizeof(aBuf), "'%s' -> '%s'", pName, aTrimmedName);
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);
pName = aTrimmedName;

// make sure that two clients doesn't have the same name
for(int i = 0; i < MAX_CLIENTS; i++)
if(i != ClientID && m_aClients[i].m_State >= CClient::STATE_READY)
{
if(str_comp(pName, m_aClients[i].m_aName) == 0)
return -1;
}

// set the client name
str_copy(m_aClients[ClientID].m_aName, pName, MAX_NAME_LENGTH);
return 0;
}



void CServer::SetClientName(int ClientID, const char *pName)
{
if(ClientID < 0 || ClientID >= MAX_CLIENTS || m_aClients[ClientID].m_State < CClient::STATE_READY)
return;

if(!pName)
if(ClientID < 0 || ClientID >= MAX_CLIENTS || m_aClients[ClientID].m_State < CClient::STATE_READY || !pName)
return;

char aCleanName[MAX_NAME_LENGTH];
str_copy(aCleanName, pName, sizeof(aCleanName));

// clear name
for(char *p = aCleanName; *p; ++p)
{
if(*p < 32)
*p = ' ';
}

if(TrySetClientName(ClientID, aCleanName))
{
// auto rename
for(int i = 1;; i++)
{
char aNameTry[MAX_NAME_LENGTH];
str_format(aNameTry, sizeof(aCleanName), "(%d)%s", i, aCleanName);
if(TrySetClientName(ClientID, aNameTry) == 0)
break;
}
}
str_copy(m_aClients[ClientID].m_aName, pName, MAX_NAME_LENGTH);
}

void CServer::SetClientClan(int ClientID, const char *pClan)
Expand Down
2 changes: 0 additions & 2 deletions src/engine/server/server.h
Expand Up @@ -170,8 +170,6 @@ class CServer : public IServer

CServer();

int TrySetClientName(int ClientID, const char *pName);

virtual void SetClientName(int ClientID, const char *pName);
virtual void SetClientClan(int ClientID, char const *pClan);
virtual void SetClientCountry(int ClientID, int Country);
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/components/chat.cpp
Expand Up @@ -396,7 +396,7 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
m_aLines[m_CurrentLine].m_NameColor = TEAM_BLUE;
}

str_copy(m_aLines[m_CurrentLine].m_aName, m_pClient->m_aClients[ClientID].m_aName, sizeof(m_aLines[m_CurrentLine].m_aName));
str_format(m_aLines[m_CurrentLine].m_aName, sizeof(m_aLines[m_CurrentLine].m_aName), "%2d: %s", ClientID, m_pClient->m_aClients[ClientID].m_aName);
str_format(m_aLines[m_CurrentLine].m_aText, sizeof(m_aLines[m_CurrentLine].m_aText), ": %s", pLine);
}

Expand Down
18 changes: 11 additions & 7 deletions src/game/client/components/hud.cpp
Expand Up @@ -208,9 +208,10 @@ void CHud::RenderScoreHud()
{
// draw name of the flag holder
int ID = FlagCarrier[t]%MAX_CLIENTS;
const char *pName = m_pClient->m_aClients[ID].m_aName;
float w = TextRender()->TextWidth(0, 8.0f, pName, -1);
TextRender()->Text(0, min(Whole-w-1.0f, Whole-ScoreWidthMax-ImageSize-2*Split), StartY+(t+1)*20.0f-3.0f, 8.0f, pName, -1);
char aName[64];
str_format(aName, sizeof(aName), "%2d: %s", ID, m_pClient->m_aClients[ID].m_aName);
float w = TextRender()->TextWidth(0, 8.0f, aName, -1);
TextRender()->Text(0, min(Whole-w-1.0f, Whole-ScoreWidthMax-ImageSize-2*Split), StartY+(t+1)*20.0f-3.0f, 8.0f, aName, -1);

// draw tee of the flag holder
CTeeRenderInfo Info = m_pClient->m_aClients[ID].m_RenderInfo;
Expand Down Expand Up @@ -281,9 +282,10 @@ void CHud::RenderScoreHud()
{
// draw name
int ID = aPlayerInfo[t].m_ClientID;
const char *pName = m_pClient->m_aClients[ID].m_aName;
float w = TextRender()->TextWidth(0, 8.0f, pName, -1);
TextRender()->Text(0, min(Whole-w-1.0f, Whole-ScoreWidthMax-ImageSize-2*Split-PosSize), StartY+(t+1)*20.0f-3.0f, 8.0f, pName, -1);
char aName[64];
str_format(aName, sizeof(aName), "%2d: %s", ID, m_pClient->m_aClients[ID].m_aName);
float w = TextRender()->TextWidth(0, 8.0f, aName, -1);
TextRender()->Text(0, min(Whole-w-1.0f, Whole-ScoreWidthMax-ImageSize-2*Split-PosSize), StartY+(t+1)*20.0f-3.0f, 8.0f, aName, -1);

// draw tee
CTeeRenderInfo Info = m_pClient->m_aClients[ID].m_RenderInfo;
Expand Down Expand Up @@ -536,9 +538,11 @@ void CHud::RenderSpectatorHud()
RenderTools()->DrawUIRect(&Rect, vec4(0.0f, 0.0f, 0.0f, 0.4f), CUI::CORNER_TL, 5.0f);

// draw the text
char aName[64];
str_format(aName, sizeof(aName), "%2d: %s", m_pClient->m_Snap.m_SpecInfo.m_SpectatorID, m_pClient->m_aClients[m_pClient->m_Snap.m_SpecInfo.m_SpectatorID].m_aName);
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Spectate"), m_pClient->m_Snap.m_SpecInfo.m_SpectatorID != SPEC_FREEVIEW ?
m_pClient->m_aClients[m_pClient->m_Snap.m_SpecInfo.m_SpectatorID].m_aName : Localize("Free-View"));
aName : Localize("Free-View"));
TextRender()->Text(0, m_Width-174.0f, m_Height-13.0f, 8.0f, aBuf, -1);
}

Expand Down
4 changes: 2 additions & 2 deletions src/game/client/components/killmessages.cpp
Expand Up @@ -26,11 +26,11 @@ void CKillMessages::OnMessage(int MsgType, void *pRawMsg)
CKillMsg Kill;
Kill.m_VictimID = pMsg->m_Victim;
Kill.m_VictimTeam = m_pClient->m_aClients[Kill.m_VictimID].m_Team;
str_copy(Kill.m_aVictimName, m_pClient->m_aClients[Kill.m_VictimID].m_aName, sizeof(Kill.m_aVictimName));
str_format(Kill.m_aVictimName, sizeof(Kill.m_aVictimName), "%2d: %s", pMsg->m_Victim, m_pClient->m_aClients[Kill.m_VictimID].m_aName);
Kill.m_VictimRenderInfo = m_pClient->m_aClients[Kill.m_VictimID].m_RenderInfo;
Kill.m_KillerID = pMsg->m_Killer;
Kill.m_KillerTeam = m_pClient->m_aClients[Kill.m_KillerID].m_Team;
str_copy(Kill.m_aKillerName, m_pClient->m_aClients[Kill.m_KillerID].m_aName, sizeof(Kill.m_aKillerName));
str_format(Kill.m_aKillerName, sizeof(Kill.m_aKillerName), "%2d: %s", pMsg->m_Killer, m_pClient->m_aClients[Kill.m_KillerID].m_aName);
Kill.m_KillerRenderInfo = m_pClient->m_aClients[Kill.m_KillerID].m_RenderInfo;
Kill.m_Weapon = pMsg->m_Weapon;
Kill.m_ModeSpecial = pMsg->m_ModeSpecial;
Expand Down
8 changes: 6 additions & 2 deletions src/game/client/components/menus_ingame.cpp
Expand Up @@ -248,7 +248,9 @@ void CMenus::RenderPlayers(CUIRect MainView)
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, Player.x, Player.y, 14.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Player.w;
TextRender()->TextEx(&Cursor, m_pClient->m_aClients[i].m_aName, -1);
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%2d: %s", i, m_pClient->m_aClients[i].m_aName);
TextRender()->TextEx(&Cursor, aBuf, -1);

TextRender()->SetCursor(&Cursor, Button.x,Button.y, 14.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = Button.w;
Expand Down Expand Up @@ -448,7 +450,9 @@ void CMenus::RenderServerControlKick(CUIRect MainView, bool FilterSpectators)
Item.m_Rect.HSplitTop(5.0f, 0, &Item.m_Rect); // some margin from the top
RenderTools()->RenderTee(CAnimState::GetIdle(), &Info, EMOTE_NORMAL, vec2(1,0), vec2(Item.m_Rect.x+Item.m_Rect.h/2, Item.m_Rect.y+Item.m_Rect.h/2));
Item.m_Rect.x +=Info.m_Size;
UI()->DoLabelScaled(&Item.m_Rect, m_pClient->m_aClients[aPlayerIDs[i]].m_aName, 16.0f, CUI::ALIGN_LEFT);
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%2d: %s", aPlayerIDs[i], m_pClient->m_aClients[aPlayerIDs[i]].m_aName);
UI()->DoLabelScaled(&Item.m_Rect, aBuf, 16.0f, CUI::ALIGN_LEFT);
}
}

Expand Down
15 changes: 5 additions & 10 deletions src/game/client/components/nameplates.cpp
Expand Up @@ -30,8 +30,10 @@ void CNamePlates::RenderNameplate(
if(g_Config.m_ClNameplatesAlways == 0)
a = clamp(1-powf(distance(m_pClient->m_pControls->m_TargetPos, Position)/200.0f,16.0f), 0.0f, 1.0f);

const char *pName = m_pClient->m_aClients[ClientID].m_aName;
float tw = TextRender()->TextWidth(0, FontSize, pName, -1);

char aName[64];
str_format(aName, sizeof(aName), "%2d: %s", ClientID, m_pClient->m_aClients[ClientID].m_aName);
float tw = TextRender()->TextWidth(0, FontSize, aName, -1);

TextRender()->TextOutlineColor(0.0f, 0.0f, 0.0f, 0.5f*a);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, a);
Expand All @@ -43,14 +45,7 @@ void CNamePlates::RenderNameplate(
TextRender()->TextColor(0.7f, 0.7f, 1.0f, a);
}

TextRender()->Text(0, Position.x-tw/2.0f, Position.y-FontSize-38.0f, FontSize, pName, -1);

if(g_Config.m_Debug) // render client id when in debug aswell
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf),"%d", ClientID);
TextRender()->Text(0, Position.x, Position.y-90, 28.0f, aBuf, -1);
}
TextRender()->Text(0, Position.x-tw/2.0f, Position.y-FontSize-38.0f, FontSize, aName, -1);

TextRender()->TextColor(1,1,1,1);
TextRender()->TextOutlineColor(0.0f, 0.0f, 0.0f, 0.3f);
Expand Down
8 changes: 6 additions & 2 deletions src/game/client/components/scoreboard.cpp
Expand Up @@ -104,7 +104,9 @@ void CScoreboard::RenderSpectators(float x, float y, float w)
TextRender()->TextEx(&Cursor, ", ", -1);
if(pInfo->m_PlayerFlags&PLAYERFLAG_WATCHING)
TextRender()->TextColor(1.0f, 1.0f, 0.0f, 1.0f);
TextRender()->TextEx(&Cursor, m_pClient->m_aClients[i].m_aName, -1);
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%2d: %s", i, m_pClient->m_aClients[i].m_aName);
TextRender()->TextEx(&Cursor, aBuf, -1);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
Multiple = true;
}
Expand Down Expand Up @@ -275,7 +277,9 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
TextRender()->TextColor(1.0f, 1.0f, 0.0f, ColorAlpha);
TextRender()->SetCursor(&Cursor, NameOffset, y+Spacing, FontSize, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = NameLength;
TextRender()->TextEx(&Cursor, m_pClient->m_aClients[pInfo->m_ClientID].m_aName, -1);
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%2d: %s", pInfo->m_ClientID, m_pClient->m_aClients[pInfo->m_ClientID].m_aName);
TextRender()->TextEx(&Cursor, aBuf, -1);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, ColorAlpha);

// clan
Expand Down
4 changes: 3 additions & 1 deletion src/game/client/components/spectator.cpp
Expand Up @@ -244,7 +244,9 @@ void CSpectator::OnRender()
Selected = true;
}
TextRender()->TextColor(1.0f, 1.0f, 1.0f, Selected?1.0f:0.5f);
TextRender()->Text(0, Width/2.0f+x+50.0f, Height/2.0f+y+5.0f, FontSize, m_pClient->m_aClients[i].m_aName, 220.0f);
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%2d: %s", i, m_pClient->m_aClients[i].m_aName);
TextRender()->Text(0, Width/2.0f+x+50.0f, Height/2.0f+y+5.0f, FontSize, aBuf, 220.0f);

// flag
if(m_pClient->m_GameInfo.m_GameFlags&GAMEFLAG_FLAGS &&
Expand Down
10 changes: 6 additions & 4 deletions src/game/client/components/voting.cpp
Expand Up @@ -175,26 +175,28 @@ void CVoting::OnMessage(int MsgType, void *pRawMsg)
if(pMsg->m_Timeout)
{
OnReset();
str_copy(m_aDescription, pMsg->m_pDescription, sizeof(m_aDescription));
str_copy(m_aReason, pMsg->m_pReason, sizeof(m_aReason));
m_Closetime = time_get() + time_freq() * pMsg->m_Timeout;
if(pMsg->m_ClientID != -1)
{
switch(pMsg->m_Type)
{
case VOTE_START_OP:
str_format(aBuf, sizeof(aBuf), Localize("'%s' called vote to change server option '%s' (%s)"), m_pClient->m_aClients[pMsg->m_ClientID].m_aName,
str_format(aBuf, sizeof(aBuf), Localize("'%2d: %s' called vote to change server option '%s' (%s)"), pMsg->m_ClientID, m_pClient->m_aClients[pMsg->m_ClientID].m_aName,
pMsg->m_pDescription, pMsg->m_pReason);
str_copy(m_aDescription, pMsg->m_pDescription, sizeof(m_aDescription));
m_pClient->m_pChat->AddLine(-1, 0, aBuf);
break;
case VOTE_START_KICK:
str_format(aBuf, sizeof(aBuf), Localize("'%s' called for vote to kick '%s' (%s)"), m_pClient->m_aClients[pMsg->m_ClientID].m_aName,
str_format(aBuf, sizeof(aBuf), Localize("'%2d: %s' called for vote to kick '%s' (%s)"), pMsg->m_ClientID, m_pClient->m_aClients[pMsg->m_ClientID].m_aName,
pMsg->m_pDescription, pMsg->m_pReason);
str_format(m_aDescription, sizeof(m_aDescription), "Kick '%s'", pMsg->m_pDescription);
m_pClient->m_pChat->AddLine(-1, 0, aBuf);
break;
case VOTE_START_SPEC:
str_format(aBuf, sizeof(aBuf), Localize("'%s' called for vote to move '%s' to spectators (%s)"), m_pClient->m_aClients[pMsg->m_ClientID].m_aName,
str_format(aBuf, sizeof(aBuf), Localize("'%2d: %s' called for vote to move '%s' to spectators (%s)"), pMsg->m_ClientID, m_pClient->m_aClients[pMsg->m_ClientID].m_aName,
pMsg->m_pDescription, pMsg->m_pReason);
str_format(m_aDescription, sizeof(m_aDescription), "Move '%s' to spectators", pMsg->m_pDescription);
m_pClient->m_pChat->AddLine(-1, 0, aBuf);
}
if(pMsg->m_ClientID == m_pClient->m_LocalClientID)
Expand Down
31 changes: 17 additions & 14 deletions src/game/client/gameclient.cpp
Expand Up @@ -546,10 +546,11 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
break;
case GAMEMSG_CTF_CAPTURE:
m_pSounds->Enqueue(CSounds::CHN_GLOBAL, SOUND_CTF_CAPTURE);
int ClientID = clamp(aParaI[1], 0, MAX_CLIENTS - 1);
if(aParaI[2] <= 60*Client()->GameTickSpeed())
str_format(aBuf, sizeof(aBuf), Localize("The %s flag was captured by '%s' (%.2f seconds)"), aParaI[0] ? Localize("blue") : Localize("red"), m_aClients[clamp(aParaI[1], 0, MAX_CLIENTS-1)].m_aName, aParaI[2]/(float)Client()->GameTickSpeed());
str_format(aBuf, sizeof(aBuf), Localize("The %s flag was captured by '%2d: %s' (%.2f seconds)"), aParaI[0] ? Localize("blue") : Localize("red"), ClientID, m_aClients[ClientID].m_aName, aParaI[2]/(float)Client()->GameTickSpeed());
else
str_format(aBuf, sizeof(aBuf), Localize("The %s flag was captured by '%s'"), aParaI[0] ? Localize("blue") : Localize("red"), m_aClients[clamp(aParaI[1], 0, MAX_CLIENTS-1)].m_aName);
str_format(aBuf, sizeof(aBuf), Localize("The %s flag was captured by '%2d: %s'"), aParaI[0] ? Localize("blue") : Localize("red"), ClientID, m_aClients[ClientID].m_aName);
m_pChat->AddLine(-1, 0, aBuf);
}
return;
Expand Down Expand Up @@ -620,12 +621,13 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)

if(m_LocalClientID != -1)
{
DoEnterMessage(pMsg->m_pName, pMsg->m_Team);
DoEnterMessage(pMsg->m_pName, pMsg->m_ClientID, pMsg->m_Team);

if(m_pDemoRecorder->IsRecording())
{
CNetMsg_De_ClientEnter Msg;
Msg.m_pName = pMsg->m_pName;
Msg.m_ClientID = pMsg->m_ClientID;
Msg.m_Team = pMsg->m_Team;
Client()->SendPackMsg(&Msg, MSGFLAG_NOSEND|MSGFLAG_RECORD);
}
Expand Down Expand Up @@ -666,10 +668,11 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
return;
}

DoLeaveMessage(m_aClients[pMsg->m_ClientID].m_aName, pMsg->m_pReason);
DoLeaveMessage(m_aClients[pMsg->m_ClientID].m_aName, pMsg->m_ClientID, pMsg->m_pReason);

CNetMsg_De_ClientLeave Msg;
Msg.m_pName = m_aClients[pMsg->m_ClientID].m_aName;
Msg.m_ClientID = pMsg->m_ClientID;
Msg.m_pReason = pMsg->m_pReason;
Client()->SendPackMsg(&Msg, MSGFLAG_NOSEND|MSGFLAG_RECORD);

Expand Down Expand Up @@ -728,7 +731,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)

if(pMsg->m_Silent == 0)
{
DoTeamChangeMessage(m_aClients[pMsg->m_ClientID].m_aName, pMsg->m_Team);
DoTeamChangeMessage(m_aClients[pMsg->m_ClientID].m_aName, pMsg->m_ClientID, pMsg->m_Team);
}
}
else if(MsgId == NETMSGTYPE_SV_READYTOENTER)
Expand All @@ -746,12 +749,12 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
else if(MsgId == NETMSGTYPE_DE_CLIENTENTER && Client()->State() == IClient::STATE_DEMOPLAYBACK)
{
CNetMsg_De_ClientEnter *pMsg = (CNetMsg_De_ClientEnter *)pRawMsg;
DoEnterMessage(pMsg->m_pName, pMsg->m_Team);
DoEnterMessage(pMsg->m_pName, pMsg->m_ClientID, pMsg->m_Team);
}
else if(MsgId == NETMSGTYPE_DE_CLIENTLEAVE && Client()->State() == IClient::STATE_DEMOPLAYBACK)
{
CNetMsg_De_ClientLeave *pMsg = (CNetMsg_De_ClientLeave *)pRawMsg;
DoLeaveMessage(pMsg->m_pName, pMsg->m_pReason);
DoLeaveMessage(pMsg->m_pName, pMsg->m_ClientID, pMsg->m_pReason);
}
}

Expand Down Expand Up @@ -1351,27 +1354,27 @@ void CGameClient::CClientData::Reset(CGameClient *pGameClient)
UpdateRenderInfo(pGameClient, false);
}

void CGameClient::DoEnterMessage(const char *pName, int Team)
void CGameClient::DoEnterMessage(const char *pName, int ClientID, int Team)
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf), Localize("'%s' entered and joined the %s"), pName, GetTeamName(Team, m_GameInfo.m_GameFlags&GAMEFLAG_TEAMS));
str_format(aBuf, sizeof(aBuf), Localize("'%2d: %s' entered and joined the %s"), ClientID, pName, GetTeamName(Team, m_GameInfo.m_GameFlags&GAMEFLAG_TEAMS));
m_pChat->AddLine(-1, 0, aBuf);
}

void CGameClient::DoLeaveMessage(const char *pName, const char *pReason)
void CGameClient::DoLeaveMessage(const char *pName, int ClientID, const char *pReason)
{
char aBuf[128];
if(pReason[0])
str_format(aBuf, sizeof(aBuf), Localize("'%s' has left the game (%s)"), pName, pReason);
str_format(aBuf, sizeof(aBuf), Localize("'%2d: %s' has left the game (%s)"), ClientID, pName, pReason);
else
str_format(aBuf, sizeof(aBuf), Localize("'%s' has left the game"), pName);
str_format(aBuf, sizeof(aBuf), Localize("'%2d: %s' has left the game"), ClientID, pName);
m_pChat->AddLine(-1, 0, aBuf);
}

void CGameClient::DoTeamChangeMessage(const char *pName, int Team)
void CGameClient::DoTeamChangeMessage(const char *pName, int ClientID, int Team)
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf), Localize("'%s' joined the %s"), pName, GetTeamName(Team, m_GameInfo.m_GameFlags&GAMEFLAG_TEAMS));
str_format(aBuf, sizeof(aBuf), Localize("'%2d: %s' joined the %s"), ClientID, pName, GetTeamName(Team, m_GameInfo.m_GameFlags&GAMEFLAG_TEAMS));
m_pChat->AddLine(-1, 0, aBuf);
}

Expand Down
6 changes: 3 additions & 3 deletions src/game/client/gameclient.h
Expand Up @@ -246,9 +246,9 @@ class CGameClient : public IGameClient
const char *GetTeamName(int Team, bool Teamplay) const;

//
void DoEnterMessage(const char *pName, int Team);
void DoLeaveMessage(const char *pName, const char *pReason);
void DoTeamChangeMessage(const char *pName, int Team);
void DoEnterMessage(const char *pName, int ClientID, int Team);
void DoLeaveMessage(const char *pName, int ClientID, const char *pReason);
void DoTeamChangeMessage(const char *pName, int ClientID, int Team);

// actions
// TODO: move these
Expand Down

0 comments on commit 85b4cfd

Please sign in to comment.