From fe4bf5704de75da3b0a07186adefdf6b93811d1f Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sun, 14 Aug 2016 17:01:01 +0200 Subject: [PATCH] Colored mapname when in lobby --- src/Components/Modules/Party.cpp | 3 ++- src/Components/Modules/ServerList.cpp | 10 +++++++++- src/Components/Modules/ServerList.hpp | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Components/Modules/Party.cpp b/src/Components/Modules/Party.cpp index 75bb6270..e5d90938 100644 --- a/src/Components/Modules/Party.cpp +++ b/src/Components/Modules/Party.cpp @@ -294,9 +294,10 @@ namespace Components info.Set("isPrivate", (Dvar::Var("g_password").Get().size() ? "1" : "0")); info.Set("hc", (Dvar::Var("g_hardcore").Get() ? "1" : "0")); info.Set("securityLevel", fmt::sprintf("%i", Dvar::Var("sv_securityLevel").Get())); + info.Set("sv_running", (Dvar::Var("sv_running").Get() ? "1" : "0")); // Ensure mapname is set - if (info.Get("mapname").empty()) + if (info.Get("mapname").empty() || (Dvar::Var("party_enable").Get() && Dvar::Var("party_host").Get() && !Dvar::Var("sv_running").Get())) { info.Set("mapname", Dvar::Var("ui_mapname").Get()); } diff --git a/src/Components/Modules/ServerList.cpp b/src/Components/Modules/ServerList.cpp index 1488c1ff..9cff72d7 100644 --- a/src/Components/Modules/ServerList.cpp +++ b/src/Components/Modules/ServerList.cpp @@ -87,7 +87,14 @@ namespace Components 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: @@ -402,6 +409,7 @@ namespace Components server.MaxClients = atoi(info.Get("sv_maxclients").data()); server.Password = (atoi(info.Get("isPrivate").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.Addr = address; diff --git a/src/Components/Modules/ServerList.hpp b/src/Components/Modules/ServerList.hpp index d35f5304..b7cc47f5 100644 --- a/src/Components/Modules/ServerList.hpp +++ b/src/Components/Modules/ServerList.hpp @@ -21,6 +21,7 @@ namespace Components int MatchType; int SecurityLevel; bool Hardcore; + bool SVRunning; }; ServerList();