diff --git a/dChatServer/ChatServer.cpp b/dChatServer/ChatServer.cpp index d136ed56..c77f9667 100644 --- a/dChatServer/ChatServer.cpp +++ b/dChatServer/ChatServer.cpp @@ -76,7 +76,6 @@ int main(int argc, char** argv) { Game::assetManager = new AssetManager(clientPath); } catch (std::runtime_error& ex) { LOG("Got an error while setting up assets: %s", ex.what()); - delete Game::server; delete Game::logger; delete Game::config; return EXIT_FAILURE; @@ -88,18 +87,18 @@ int main(int argc, char** argv) { } catch (std::exception& ex) { LOG("Got an error while connecting to the database: %s", ex.what()); Database::Destroy("ChatServer"); - delete Game::server; delete Game::logger; delete Game::config; return EXIT_FAILURE; } + // seyup the chat api web server bool web_server_enabled = Game::config->GetValue("web_server_enabled") == "1"; ChatWebAPI chatwebapi; if (web_server_enabled && !chatwebapi.Startup()){ + // if we want the web api and it fails to start, exit LOG("Failed to start web server, shutting down."); Database::Destroy("ChatServer"); - delete Game::server; delete Game::logger; delete Game::config; return EXIT_FAILURE; diff --git a/dChatServer/ChatWebAPI.cpp b/dChatServer/ChatWebAPI.cpp index 36911095..75ff2d64 100644 --- a/dChatServer/ChatWebAPI.cpp +++ b/dChatServer/ChatWebAPI.cpp @@ -149,7 +149,7 @@ ChatWebAPI::~ChatWebAPI() { } bool ChatWebAPI::Startup() { - // make listen address + // Make listen address std::string listen_ip = Game::config->GetValue("web_server_listen_ip"); if (listen_ip == "localhost") listen_ip = "127.0.0.1"; diff --git a/dChatServer/PlayerContainer.h b/dChatServer/PlayerContainer.h index 18149a24..3a06ad9f 100644 --- a/dChatServer/PlayerContainer.h +++ b/dChatServer/PlayerContainer.h @@ -97,8 +97,8 @@ public: LWOOBJID GetId(const std::u16string& playerName); uint32_t GetMaxNumberOfBestFriends() { return m_MaxNumberOfBestFriends; } uint32_t GetMaxNumberOfFriends() { return m_MaxNumberOfFriends; } - const TeamContainer& GetTeamContainer() { return teamContainer; } - std::vector& GetTeamsMut() { return teamContainer.mTeams; }; + const TeamContainer& GetTeamContainer() { return m_TeamContainer; } + std::vector& GetTeamsMut() { return m_TeamContainer.mTeams; }; const std::vector& GetTeams() { return GetTeamsMut(); }; void Update(const float deltaTime); @@ -107,7 +107,7 @@ public: private: LWOOBJID m_TeamIDCounter = 0; std::map m_Players; - TeamContainer teamContainer{}; + TeamContainer m_TeamContainer{}; std::unordered_map m_Names; std::map m_PlayersToRemove; uint32_t m_MaxNumberOfBestFriends = 5;