From 4a577f233d22c1496d02c24ebd156a187293eb02 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Sun, 21 Sep 2025 18:12:50 -0700 Subject: [PATCH] fix: hardcore mode fixes (#1883) fixes hardcore modes uscore drops adds config option for excluded item drops f feat: Add logging for config options on load and reload feat: Add logging for config options on load and reload --- dAuthServer/AuthServer.cpp | 1 + dChatServer/ChatServer.cpp | 1 + dCommon/dConfig.cpp | 9 +++++++++ dCommon/dConfig.h | 4 +++- dMasterServer/MasterServer.cpp | 1 + dWorldServer/WorldServer.cpp | 1 + 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dAuthServer/AuthServer.cpp b/dAuthServer/AuthServer.cpp index 1905fa73..505b1f1a 100644 --- a/dAuthServer/AuthServer.cpp +++ b/dAuthServer/AuthServer.cpp @@ -52,6 +52,7 @@ int main(int argc, char** argv) { //Create all the objects we need to run our service: Server::SetupLogger("AuthServer"); if (!Game::logger) return EXIT_FAILURE; + Game::config->LogSettings(); LOG("Starting Auth server..."); LOG("Version: %s", PROJECT_VERSION); diff --git a/dChatServer/ChatServer.cpp b/dChatServer/ChatServer.cpp index 9cabbf28..34b4d6e3 100644 --- a/dChatServer/ChatServer.cpp +++ b/dChatServer/ChatServer.cpp @@ -59,6 +59,7 @@ int main(int argc, char** argv) { //Create all the objects we need to run our service: Server::SetupLogger("ChatServer"); if (!Game::logger) return EXIT_FAILURE; + Game::config->LogSettings(); //Read our config: diff --git a/dCommon/dConfig.cpp b/dCommon/dConfig.cpp index bed274b0..72a07d5b 100644 --- a/dCommon/dConfig.cpp +++ b/dCommon/dConfig.cpp @@ -47,6 +47,7 @@ void dConfig::LoadConfig() { void dConfig::ReloadConfig() { this->m_ConfigValues.clear(); LoadConfig(); + LogSettings(); } const std::string& dConfig::GetValue(std::string key) { @@ -58,6 +59,14 @@ const std::string& dConfig::GetValue(std::string key) { return this->m_ConfigValues[key]; } +void dConfig::LogSettings() const { + LOG("Configuration settings:"); + for (const auto& [key, value] : m_ConfigValues) { + const auto& valueLog = key.find("password") != std::string::npos ? "" : value; + LOG(" %s = %s", key.c_str(), valueLog.c_str()); + } +} + void dConfig::ProcessLine(const std::string& line) { auto splitLoc = line.find('='); auto key = line.substr(0, splitLoc); diff --git a/dCommon/dConfig.h b/dCommon/dConfig.h index 65415eea..59923b78 100644 --- a/dCommon/dConfig.h +++ b/dCommon/dConfig.h @@ -29,10 +29,12 @@ public: * Reloads the config file to reset values */ void ReloadConfig(); + + void LogSettings() const; + private: void ProcessLine(const std::string& line); -private: std::map m_ConfigValues; std::string m_ConfigFilePath; }; diff --git a/dMasterServer/MasterServer.cpp b/dMasterServer/MasterServer.cpp index 2d108a2d..34d44ea8 100644 --- a/dMasterServer/MasterServer.cpp +++ b/dMasterServer/MasterServer.cpp @@ -99,6 +99,7 @@ int main(int argc, char** argv) { //Create all the objects we need to run our service: Server::SetupLogger("MasterServer"); if (!Game::logger) return EXIT_FAILURE; + Game::config->LogSettings(); auto folders = { "navmeshes", "migrations", "vanity" }; diff --git a/dWorldServer/WorldServer.cpp b/dWorldServer/WorldServer.cpp index ec3ca128..f655bac7 100644 --- a/dWorldServer/WorldServer.cpp +++ b/dWorldServer/WorldServer.cpp @@ -159,6 +159,7 @@ int main(int argc, char** argv) { //Create all the objects we need to run our service: Server::SetupLogger("WorldServer_" + std::to_string(zoneID) + "_" + std::to_string(g_InstanceID)); if (!Game::logger) return EXIT_FAILURE; + Game::config->LogSettings(); LOG("Starting World server..."); LOG("Version: %s", Game::projectVersion.c_str());