cl_show_ids also shows ID in chat (fixes #454)

This commit is contained in:
def 2016-05-14 01:17:18 +02:00
parent ff747953b4
commit d1275f239a

View file

@ -666,12 +666,26 @@ void CChat::OnRender()
if(Now > m_aLines[r].m_Time+16*time_freq() && !m_Show)
break;
char aName[64] = "";
if(g_Config.m_ClShowIDs && m_aLines[r].m_ClientID != -1 && m_aLines[r].m_aName[0] != '\0')
{
if (m_aLines[r].m_ClientID >= 10)
str_format(aName, sizeof(aName),"%d: ", m_aLines[r].m_ClientID);
else
str_format(aName, sizeof(aName),"%d: ", m_aLines[r].m_ClientID);
str_append(aName, m_aLines[r].m_aName,sizeof(aName));
}
else
{
str_copy(aName, m_aLines[r].m_aName, sizeof(aName));
}
// get the y offset (calculate it if we haven't done that yet)
if(m_aLines[r].m_YOffset[OffsetType] < 0.0f)
{
TextRender()->SetCursor(&Cursor, Begin, 0.0f, FontSize, 0);
Cursor.m_LineWidth = LineWidth;
TextRender()->TextEx(&Cursor, m_aLines[r].m_aName, -1);
TextRender()->TextEx(&Cursor, aName, -1);
TextRender()->TextEx(&Cursor, m_aLines[r].m_aText, -1);
m_aLines[r].m_YOffset[OffsetType] = Cursor.m_Y + Cursor.m_FontSize;
}
@ -710,7 +724,7 @@ void CChat::OnRender()
else
TextRender()->TextColor(0.8f, 0.8f, 0.8f, Blend);
TextRender()->TextEx(&Cursor, m_aLines[r].m_aName, -1);
TextRender()->TextEx(&Cursor, aName, -1);
// render line
if (m_aLines[r].m_ClientID == -1)