Use TextRenderer to strip material text icons from dedicated server names and chat messages
This commit is contained in:
parent
967eeb2989
commit
1821d9072e
@ -76,29 +76,6 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
void Dedicated::StripMaterialTextIcons(char* text)
|
||||
{
|
||||
char* currentChar = text;
|
||||
bool isEscaped = false;
|
||||
while (*currentChar)
|
||||
{
|
||||
if (*currentChar == '^')
|
||||
{
|
||||
isEscaped = true;
|
||||
}
|
||||
else if(isEscaped == true && (*currentChar == '\x01' || *currentChar == '\x02'))
|
||||
{
|
||||
*currentChar = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
isEscaped = false;
|
||||
}
|
||||
|
||||
currentChar++;
|
||||
}
|
||||
}
|
||||
|
||||
const char* Dedicated::EvaluateSay(char* text, Game::gentity_t* player)
|
||||
{
|
||||
Dedicated::SendChat = true;
|
||||
@ -110,7 +87,7 @@ namespace Components
|
||||
++text;
|
||||
}
|
||||
|
||||
StripMaterialTextIcons(text);
|
||||
TextRenderer::StripMaterialTextIcons(text, text, strlen(text) + 1);
|
||||
|
||||
Game::Scr_AddEntity(player);
|
||||
Game::Scr_AddString(text + 1);
|
||||
|
@ -14,8 +14,6 @@ namespace Components
|
||||
|
||||
static void Heartbeat();
|
||||
|
||||
static void StripMaterialTextIcons(char* text);
|
||||
|
||||
private:
|
||||
static bool SendChat;
|
||||
|
||||
|
@ -469,10 +469,10 @@ namespace Components
|
||||
server.ping = (Game::Sys_Milliseconds() - i->sendTime);
|
||||
server.addr = address;
|
||||
|
||||
Dedicated::StripMaterialTextIcons(server.hostname.data());
|
||||
Dedicated::StripMaterialTextIcons(server.mapname.data());
|
||||
Dedicated::StripMaterialTextIcons(server.gametype.data());
|
||||
Dedicated::StripMaterialTextIcons(server.mod.data());
|
||||
server.hostname = TextRenderer::StripMaterialTextIcons(server.hostname);
|
||||
server.mapname = TextRenderer::StripMaterialTextIcons(server.mapname);
|
||||
server.gametype = TextRenderer::StripMaterialTextIcons(server.gametype);
|
||||
server.mod = TextRenderer::StripMaterialTextIcons(server.mod);
|
||||
|
||||
// Remove server from queue
|
||||
i = ServerList::RefreshContainer.servers.erase(i);
|
||||
|
Loading…
Reference in New Issue
Block a user