aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-25 00:39:08 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-25 00:39:08 +0000
commitc488ea907ce56e3d52e7bd02a082b2fd1fe1a205 (patch)
treec0e929227a9b3a94846dac0818f752bfa249c58e
parenta5485d77e4695fa777cae689aa9196ff63d3dd36 (diff)
downloadNorthstarLauncher-c488ea907ce56e3d52e7bd02a082b2fd1fe1a205.tar.gz
NorthstarLauncher-c488ea907ce56e3d52e7bd02a082b2fd1fe1a205.zip
fix a bug with launcher not showing servers
-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;