comments and tweaks

This commit is contained in:
Aaron Kimbre 2025-01-15 14:59:30 -06:00
parent 5b8fe2cba0
commit 9542216650
3 changed files with 6 additions and 7 deletions

View File

@ -76,7 +76,6 @@ int main(int argc, char** argv) {
Game::assetManager = new AssetManager(clientPath); Game::assetManager = new AssetManager(clientPath);
} catch (std::runtime_error& ex) { } catch (std::runtime_error& ex) {
LOG("Got an error while setting up assets: %s", ex.what()); LOG("Got an error while setting up assets: %s", ex.what());
delete Game::server;
delete Game::logger; delete Game::logger;
delete Game::config; delete Game::config;
return EXIT_FAILURE; return EXIT_FAILURE;
@ -88,18 +87,18 @@ int main(int argc, char** argv) {
} catch (std::exception& ex) { } catch (std::exception& ex) {
LOG("Got an error while connecting to the database: %s", ex.what()); LOG("Got an error while connecting to the database: %s", ex.what());
Database::Destroy("ChatServer"); Database::Destroy("ChatServer");
delete Game::server;
delete Game::logger; delete Game::logger;
delete Game::config; delete Game::config;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
// seyup the chat api web server
bool web_server_enabled = Game::config->GetValue("web_server_enabled") == "1"; bool web_server_enabled = Game::config->GetValue("web_server_enabled") == "1";
ChatWebAPI chatwebapi; ChatWebAPI chatwebapi;
if (web_server_enabled && !chatwebapi.Startup()){ 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."); LOG("Failed to start web server, shutting down.");
Database::Destroy("ChatServer"); Database::Destroy("ChatServer");
delete Game::server;
delete Game::logger; delete Game::logger;
delete Game::config; delete Game::config;
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@ -149,7 +149,7 @@ ChatWebAPI::~ChatWebAPI() {
} }
bool ChatWebAPI::Startup() { bool ChatWebAPI::Startup() {
// make listen address // Make listen address
std::string listen_ip = Game::config->GetValue("web_server_listen_ip"); std::string listen_ip = Game::config->GetValue("web_server_listen_ip");
if (listen_ip == "localhost") listen_ip = "127.0.0.1"; if (listen_ip == "localhost") listen_ip = "127.0.0.1";

View File

@ -97,8 +97,8 @@ public:
LWOOBJID GetId(const std::u16string& playerName); LWOOBJID GetId(const std::u16string& playerName);
uint32_t GetMaxNumberOfBestFriends() { return m_MaxNumberOfBestFriends; } uint32_t GetMaxNumberOfBestFriends() { return m_MaxNumberOfBestFriends; }
uint32_t GetMaxNumberOfFriends() { return m_MaxNumberOfFriends; } uint32_t GetMaxNumberOfFriends() { return m_MaxNumberOfFriends; }
const TeamContainer& GetTeamContainer() { return teamContainer; } const TeamContainer& GetTeamContainer() { return m_TeamContainer; }
std::vector<TeamData*>& GetTeamsMut() { return teamContainer.mTeams; }; std::vector<TeamData*>& GetTeamsMut() { return m_TeamContainer.mTeams; };
const std::vector<TeamData*>& GetTeams() { return GetTeamsMut(); }; const std::vector<TeamData*>& GetTeams() { return GetTeamsMut(); };
void Update(const float deltaTime); void Update(const float deltaTime);
@ -107,7 +107,7 @@ public:
private: private:
LWOOBJID m_TeamIDCounter = 0; LWOOBJID m_TeamIDCounter = 0;
std::map<LWOOBJID, PlayerData> m_Players; std::map<LWOOBJID, PlayerData> m_Players;
TeamContainer teamContainer{}; TeamContainer m_TeamContainer{};
std::unordered_map<LWOOBJID, std::u16string> m_Names; std::unordered_map<LWOOBJID, std::u16string> m_Names;
std::map<LWOOBJID, float> m_PlayersToRemove; std::map<LWOOBJID, float> m_PlayersToRemove;
uint32_t m_MaxNumberOfBestFriends = 5; uint32_t m_MaxNumberOfBestFriends = 5;