diff --git a/include/Common.h b/include/Common.h index 291fd66..337cfd0 100644 --- a/include/Common.h +++ b/include/Common.h @@ -86,8 +86,6 @@ public: static std::string GetBackendUrlForAuth(); static std::string GetBackendUrlForSocketIO(); - static void TopLevelDomainFailed(bool failed); - static std::string RegionToTopLevelDomain(const std::string region); static void CheckForUpdates(); static std::array VersionStrToInts(const std::string& str); static bool IsOutdated(const Version& Current, const Version& Newest); diff --git a/src/TConfig.cpp b/src/TConfig.cpp index 98f1ed3..d53ff1a 100644 --- a/src/TConfig.cpp +++ b/src/TConfig.cpp @@ -226,16 +226,22 @@ void TConfig::TryReadValue(toml::value& Table, const std::string& Category, cons if constexpr (std::is_same_v) { if (Table[Category.c_str()][Key.data()].is_string()) Application::Settings.set(key, Table[Category.c_str()][Key.data()].as_string()); + else if (Table[Category.c_str()][Key.data()].is_empty()) + beammp_debugf("Value '{}.{}' is empty", Category, Key); else beammp_warnf("Value '{}.{}' has unexpected type, expected type 'string'", Category, Key); } else if constexpr (std::is_same_v) { if (Table[Category.c_str()][Key.data()].is_integer()) Application::Settings.set(key, int(Table[Category.c_str()][Key.data()].as_integer())); + else if (Table[Category.c_str()][Key.data()].is_empty()) + beammp_debugf("Value '{}.{}' is empty", Category, Key); else beammp_warnf("Value '{}.{}' has unexpected type, expected type 'integer'", Category, Key); } else if constexpr (std::is_same_v) { if (Table[Category.c_str()][Key.data()].is_boolean()) Application::Settings.set(key, Table[Category.c_str()][Key.data()].as_boolean()); + else if (Table[Category.c_str()][Key.data()].is_empty()) + beammp_debugf("Value '{}.{}' is empty", Category, Key); else beammp_warnf("Value '{}.{}' has unexpected type, expected type 'boolean'", Category, Key); } else { diff --git a/src/TConsole.cpp b/src/TConsole.cpp index 8c86b65..a856142 100644 --- a/src/TConsole.cpp +++ b/src/TConsole.cpp @@ -25,6 +25,7 @@ #include "Http.h" #include "LuaAPI.h" #include "TLuaEngine.h" +#include "RegionHandler.h" #include #include @@ -298,7 +299,7 @@ void TConsole::Command_NetTest(const std::string& cmd, const std::vector @@ -63,7 +64,7 @@ void THeartbeatThread::operator()() { for (const auto& Url : Application::GetBackendUrlsInOrder()) { T = Http::POST(Url + Target, Body, "application/json", &ResponseCode, { { "api-v", "2" } }); if (T == Http::ErrorString || ResponseCode != 200) { - Application::TopLevelDomainFailed(); + RegionHandler::TopLevelDomainFailed(); T = Http::POST(Url + Target, Body, "application/json", &ResponseCode, { { "api-v", "2" } }); } diff --git a/src/TNetwork.cpp b/src/TNetwork.cpp index a122f35..874b127 100644 --- a/src/TNetwork.cpp +++ b/src/TNetwork.cpp @@ -20,6 +20,7 @@ #include "Client.h" #include "Common.h" #include "LuaAPI.h" +#include "RegionHandler.h" #include "TConnectionLimiter.h" #include "THeartbeatThread.h" #include "TLuaEngine.h" @@ -441,7 +442,7 @@ std::shared_ptr TNetwork::Authentication(TConnection&& RawConnection) { unsigned int ResponseCode = 0; AuthResStr = Http::POST(Application::GetBackendUrlForAuth() + Target, AuthReq.dump(), "application/json", &ResponseCode); if (AuthResStr == Http::ErrorString || ResponseCode != 200) { - Application::TopLevelDomainFailed(); + RegionHandler::TopLevelDomainFailed(); AuthResStr = Http::POST(Application::GetBackendUrlForAuth() + Target, AuthReq.dump(), "application/json", &ResponseCode); }