Colored mapname when in lobby

This commit is contained in:
momo5502 2016-08-14 17:01:01 +02:00
parent 19d177ed29
commit fe4bf5704d
3 changed files with 12 additions and 2 deletions

View File

@ -294,9 +294,10 @@ namespace Components
info.Set("isPrivate", (Dvar::Var("g_password").Get<std::string>().size() ? "1" : "0")); info.Set("isPrivate", (Dvar::Var("g_password").Get<std::string>().size() ? "1" : "0"));
info.Set("hc", (Dvar::Var("g_hardcore").Get<bool>() ? "1" : "0")); info.Set("hc", (Dvar::Var("g_hardcore").Get<bool>() ? "1" : "0"));
info.Set("securityLevel", fmt::sprintf("%i", Dvar::Var("sv_securityLevel").Get<int>())); info.Set("securityLevel", fmt::sprintf("%i", Dvar::Var("sv_securityLevel").Get<int>()));
info.Set("sv_running", (Dvar::Var("sv_running").Get<bool>() ? "1" : "0"));
// Ensure mapname is set // Ensure mapname is set
if (info.Get("mapname").empty()) if (info.Get("mapname").empty() || (Dvar::Var("party_enable").Get<bool>() && Dvar::Var("party_host").Get<bool>() && !Dvar::Var("sv_running").Get<bool>()))
{ {
info.Set("mapname", Dvar::Var("ui_mapname").Get<const char*>()); info.Set("mapname", Dvar::Var("ui_mapname").Get<const char*>());
} }

View File

@ -87,7 +87,14 @@ namespace Components
case Column::Mapname: case Column::Mapname:
{ {
return Game::UI_LocalizeMapName(server->Mapname.data()); if (server->SVRunning)
{
return Game::UI_LocalizeMapName(server->Mapname.data());
}
else
{
return Utils::String::VA("^3%s", Game::UI_LocalizeMapName(server->Mapname.data()));
}
} }
case Column::Players: case Column::Players:
@ -402,6 +409,7 @@ namespace Components
server.MaxClients = atoi(info.Get("sv_maxclients").data()); server.MaxClients = atoi(info.Get("sv_maxclients").data());
server.Password = (atoi(info.Get("isPrivate").data()) != 0); server.Password = (atoi(info.Get("isPrivate").data()) != 0);
server.Hardcore = (atoi(info.Get("hc").data()) != 0); server.Hardcore = (atoi(info.Get("hc").data()) != 0);
server.SVRunning = (atoi(info.Get("sv_running").data()) != 0);
server.Ping = (Game::Sys_Milliseconds() - i->SendTime); server.Ping = (Game::Sys_Milliseconds() - i->SendTime);
server.Addr = address; server.Addr = address;

View File

@ -21,6 +21,7 @@ namespace Components
int MatchType; int MatchType;
int SecurityLevel; int SecurityLevel;
bool Hardcore; bool Hardcore;
bool SVRunning;
}; };
ServerList(); ServerList();