Password and hc.

This commit is contained in:
momo5502 2016-01-04 18:28:11 +01:00
parent a568e253eb
commit 069fb88517
3 changed files with 9 additions and 5 deletions

View File

@ -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);

View File

@ -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<const char*>());
info.Set("isPrivate", (Dvar::Var("g_password").Get<std::string>().size() ? "1" : "0"));
info.Set("hc", (Dvar::Var("g_hardcore").Get<bool>() ? "1" : "0"));
// Ensure mapname is set
if (!info.Get("mapname").size())

View File

@ -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)
{