From bed8c6f172c1f27211402a8ef445f714ba36f73e Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Tue, 2 Jan 2024 13:59:53 -0600 Subject: [PATCH] Revert master server changes --- dMasterServer/MasterServer.cpp | 39 ++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/dMasterServer/MasterServer.cpp b/dMasterServer/MasterServer.cpp index d1bbc41d..fbece646 100644 --- a/dMasterServer/MasterServer.cpp +++ b/dMasterServer/MasterServer.cpp @@ -81,18 +81,43 @@ int main(int argc, char** argv) { Game::logger = SetupLogger(); if (!Game::logger) return EXIT_FAILURE; - if (!dConfig::Exists("authconfig.ini")) LOG("Couldnt find authconfig.ini."); - if (!dConfig::Exists("chatconfig.ini")) LOG("Couldnt find chatconfig.ini"); - if (!dConfig::Exists("masterconfig.ini")) LOG("Couldnt find masterconfig.ini"); - if (!dConfig::Exists("sharedconfig.ini")) LOG("Couldnt find sharedconfig.ini"); - if (!dConfig::Exists("worldconfig.ini")) LOG("Couldnt find worldconfig.ini"); + if (!dConfig::Exists("authconfig.ini")) { + LOG("Couldnt find authconfig.ini"); + return EXIT_FAILURE; + } + + if (!dConfig::Exists("chatconfig.ini")) { + LOG("Couldnt find chatconfig.ini"); + return EXIT_FAILURE; + } + + if (!dConfig::Exists("masterconfig.ini")) { + LOG("Couldnt find masterconfig.ini"); + return EXIT_FAILURE; + } + + if (!dConfig::Exists("sharedconfig.ini")) { + LOG("Couldnt find sharedconfig.ini"); + return EXIT_FAILURE; + } + + if (!dConfig::Exists("worldconfig.ini")) { + LOG("Couldnt find worldconfig.ini"); + return EXIT_FAILURE; + } Game::config = new dConfig("masterconfig.ini"); Game::logger->SetLogToConsole(Game::config->GetValue("log_to_console") != "0"); Game::logger->SetLogDebugStatements(Game::config->GetValue("log_debug_statements") == "1"); - uint32_t clientNetVersion = 171022; - GeneralUtils::TryParse(Game::config->GetValue("client_net_version"), clientNetVersion); + uint32_t clientNetVersion = 0; + if (!GeneralUtils::TryParse(Game::config->GetValue("client_net_version"), clientNetVersion)) { + LOG("Failed to parse (%s) as net version. Cannot start server as no clients could connect.",Game::config->GetValue("client_net_version").c_str()); + LOG("As of version 1.1.1, client_net_version is required to be defined in sharedconfig.ini as opposed to in CMakeVariables.txt as NET_VERSION."); + LOG("Rerun cmake to ensure all config values exist. If client_net_version already exists in sharedconfig.ini, please ensure it is a valid number."); + LOG("like 171022"); + return EXIT_FAILURE; + } LOG("Using net version %s", Game::config->GetValue("client_net_version").c_str());