From df33f6821c634c4afbada27c0e2723053d74ce35 Mon Sep 17 00:00:00 2001 From: "mtilden@gmail.com" Date: Tue, 27 Dec 2011 19:01:00 +0000 Subject: Vanity, just to set back to white after a short enough name for the ping image to not change color git-svn-id: http://mc-server.googlecode.com/svn/trunk@136 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/packets/cPacket_PlayerListItem.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/packets/cPacket_PlayerListItem.cpp b/source/packets/cPacket_PlayerListItem.cpp index 669f5705b..e19dd902c 100644 --- a/source/packets/cPacket_PlayerListItem.cpp +++ b/source/packets/cPacket_PlayerListItem.cpp @@ -1,4 +1,5 @@ #include "cPacket_PlayerListItem.h" +#include "cChatColor.h" cPacket_PlayerListItem::cPacket_PlayerListItem(std::string a_PlayerName, bool a_Online, short a_Ping) { @@ -19,7 +20,12 @@ bool cPacket_PlayerListItem::Parse( cSocket & a_Socket ) bool cPacket_PlayerListItem::Send( cSocket & a_Socket ) { - m_PlayerName = m_PlayerName.substr(0,16); + int len = m_PlayerName.length(); + int end = (len <= 16) ? len : 16; + m_PlayerName = m_PlayerName.substr(0, end); + if (len <= 14) + m_PlayerName += cChatColor::MakeColor((char)cChatColor::White.c_str()); + unsigned int TotalSize = c_Size + m_PlayerName.size()*sizeof(short); char* Message = new char[TotalSize]; -- cgit v1.2.3