aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/masterserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDedicatedTest/masterserver.cpp')
-rw-r--r--NorthstarDedicatedTest/masterserver.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/NorthstarDedicatedTest/masterserver.cpp b/NorthstarDedicatedTest/masterserver.cpp
index e9cf043a..69a27454 100644
--- a/NorthstarDedicatedTest/masterserver.cpp
+++ b/NorthstarDedicatedTest/masterserver.cpp
@@ -185,13 +185,11 @@ void MasterServerManager::RequestServerList()
}
// todo: verify json props are fine before adding to m_remoteServers
-
if (!serverObj.HasMember("id") || !serverObj["id"].IsString()
|| !serverObj.HasMember("name") || !serverObj["name"].IsString()
|| !serverObj.HasMember("description") || !serverObj["description"].IsString()
|| !serverObj.HasMember("map") || !serverObj["map"].IsString()
|| !serverObj.HasMember("playlist") || !serverObj["playlist"].IsString()
- || !serverObj.HasMember("playerCount") || !serverObj["playerCount"].IsNumber()
|| !serverObj.HasMember("maxPlayers") || !serverObj["maxPlayers"].IsNumber()
|| !serverObj.HasMember("hasPassword") || !serverObj["hasPassword"].IsBool()
|| !serverObj.HasMember("modInfo") || !serverObj["modInfo"].HasMember("Mods") || !serverObj["modInfo"]["Mods"].IsArray() )
@@ -200,6 +198,12 @@ void MasterServerManager::RequestServerList()
goto REQUEST_END_CLEANUP;
}
+ int playerCount = 0;
+ if (!serverObj.HasMember("playerCount") || !serverObj["playerCount"].IsNumber())
+ playerCount = 0;
+ else
+ playerCount = serverObj["playerCount"].GetInt();
+
const char* id = serverObj["id"].GetString();
RemoteServerInfo* newServer = nullptr;
@@ -210,7 +214,7 @@ void MasterServerManager::RequestServerList()
// if server already exists, update info rather than adding to it
if (!strncmp((const char*)server.id, id, 32))
{
- server = RemoteServerInfo(id, serverObj["name"].GetString(), serverObj["description"].GetString(), serverObj["map"].GetString(), serverObj["playlist"].GetString(), serverObj["playerCount"].GetInt(), serverObj["maxPlayers"].GetInt(), serverObj["hasPassword"].IsTrue());
+ server = RemoteServerInfo(id, serverObj["name"].GetString(), serverObj["description"].GetString(), serverObj["map"].GetString(), serverObj["playlist"].GetString(), playerCount, serverObj["maxPlayers"].GetInt(), serverObj["hasPassword"].IsTrue());
newServer = &server;
createNewServerInfo = false;
break;