From 069fb88517f636c24d7523572c5a228b291460ba Mon Sep 17 00:00:00 2001 From: momo5502 Date: Mon, 4 Jan 2016 18:28:11 +0100 Subject: [PATCH] Password and hc. --- src/Components/Modules/Discovery.cpp | 2 +- src/Components/Modules/Party.cpp | 2 ++ src/Components/Modules/ServerList.cpp | 10 ++++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Components/Modules/Discovery.cpp b/src/Components/Modules/Discovery.cpp index aea8ce0f..592db0cc 100644 --- a/src/Components/Modules/Discovery.cpp +++ b/src/Components/Modules/Discovery.cpp @@ -28,7 +28,7 @@ namespace Components Discovery::DiscoveryContainer.Challenge = Utils::VA("%d", Game::Com_Milliseconds()); //Network::BroadcastAll("discovery\n"); - Network::BroadcastRange(28960, 38960, Utils::VA("discovery\n%s", Discovery::DiscoveryContainer.Challenge.data())); + Network::BroadcastRange(25000, 35000, Utils::VA("discovery\n%s", Discovery::DiscoveryContainer.Challenge.data())); Logger::Print("Discovery sent within %dms, awaiting responses...\n", Game::Com_Milliseconds() - start); diff --git a/src/Components/Modules/Party.cpp b/src/Components/Modules/Party.cpp index bd830638..80546c5f 100644 --- a/src/Components/Modules/Party.cpp +++ b/src/Components/Modules/Party.cpp @@ -262,6 +262,8 @@ namespace Components info.Set("shortversion", VERSION_STR); info.Set("checksum", Utils::VA("%d", Game::Com_Milliseconds())); info.Set("mapname", Dvar::Var("mapname").Get()); + info.Set("isPrivate", (Dvar::Var("g_password").Get().size() ? "1" : "0")); + info.Set("hc", (Dvar::Var("g_hardcore").Get() ? "1" : "0")); // Ensure mapname is set if (!info.Get("mapname").size()) diff --git a/src/Components/Modules/ServerList.cpp b/src/Components/Modules/ServerList.cpp index 8d0b2bb8..7e04e4fb 100644 --- a/src/Components/Modules/ServerList.cpp +++ b/src/Components/Modules/ServerList.cpp @@ -126,6 +126,8 @@ namespace Components void ServerList::Refresh() { + Localization::Set("MPUI_SERVERQUERIED", "Sent requests: 0/0"); + // ServerList::OnlineList.clear(); // ServerList::OfflineList.clear(); // ServerList::FavouriteList.clear(); @@ -218,7 +220,8 @@ namespace Components server.MatchType = atoi(info.Get("matchtype").data()); server.Clients = atoi(info.Get("clients").data()); server.MaxClients = atoi(info.Get("sv_maxclients").data()); - server.Password = 0; // No info yet + server.Password = (atoi(info.Get("isPrivate").data()) != 0); + server.Hardcore = (atoi(info.Get("hc").data()) != 0); server.Ping = (Game::Com_Milliseconds() - i->SendTime); server.Addr = address; @@ -342,8 +345,7 @@ namespace Components Network::Send(server->Target, Utils::VA("getinfo %s\n", server->Challenge.data())); // Display in the menu, like in COD4 - //Logger::Print("Sent %d/%d\n", ServerList::RefreshContainer.SentCount, ServerList::RefreshContainer.SendCount); - Localization::Set("MPUI_SERVERQUERIED", Utils::VA("Queried: %d/%d", ServerList::RefreshContainer.SentCount, ServerList::RefreshContainer.SendCount)); + Localization::Set("MPUI_SERVERQUERIED", Utils::VA("Sent requests: %d/%d", ServerList::RefreshContainer.SentCount, ServerList::RefreshContainer.SendCount)); if (SendServers <= 0) break; } @@ -372,7 +374,7 @@ namespace Components ServerList::OnlineList.clear(); ServerList::VisibleList.clear(); - Localization::Set("MPUI_SERVERQUERIED", "Queried: 0/0"); + Localization::Set("MPUI_SERVERQUERIED", "Sent requests: 0/0"); Network::Handle("getServersResponse", [] (Network::Address address, std::string data) {