diff options
| author | Shauren <shauren.trinity@gmail.com> | 2024-04-30 00:20:38 +0200 |
|---|---|---|
| committer | Ovahlord <dreadkiller@gmx.de> | 2024-05-28 16:47:32 +0200 |
| commit | 3cf1aaaf56f0f7e556dfaa7b3516c1a52abacb8f (patch) | |
| tree | 69c30943bd575f0c40a61fdfd9d1bb1bd217983b /src/server/game/World | |
| parent | beb9b4607d0f8309ae25c2a01596b42b250559c7 (diff) | |
Core/Misc: Refactor loading process to remove exit() calls that cause deadlocks because threads are terminated without proper cleanup
(cherry picked from commit 8e3024a96ab06b5e2d6da529c5e3db9ce5744c4e)
Diffstat (limited to 'src/server/game/World')
| -rw-r--r-- | src/server/game/World/World.cpp | 11 | ||||
| -rw-r--r-- | src/server/game/World/World.h | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 31519a4ff1d..e53fdc17022 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1729,7 +1729,7 @@ void World::LoadConfigSettings(bool reload) } /// Initialize the World -void World::SetInitialWorldSettings() +bool World::SetInitialWorldSettings() { sLog->SetRealmId(realm.Id.Realm); @@ -1768,7 +1768,7 @@ void World::SetInitialWorldSettings() !TerrainMgr::ExistMapAndVMap(530, -3961.64f, -13931.2f)))) { TC_LOG_FATAL("server.loading", "Unable to load map and vmap data for starting zones - server shutting down!"); - exit(1); + return false; } ///- Initialize pool manager @@ -1781,7 +1781,7 @@ void World::SetInitialWorldSettings() TC_LOG_INFO("server.loading", "Loading Trinity strings..."); if (!sObjectMgr->LoadTrinityStrings()) - exit(1); // Error message displayed in function already + return false; // Error message displayed in function already ///- Update the realm entry in the database with the realm type from the config file //No SQL injection as values are treated as integers @@ -1798,14 +1798,14 @@ void World::SetInitialWorldSettings() if (!(m_availableDbcLocaleMask & (1 << m_defaultDbcLocale))) { TC_LOG_FATAL("server.loading", "Unable to load db2 files for {} locale specified in DBC.Locale config!", localeNames[m_defaultDbcLocale]); - exit(1); + return false; } TC_LOG_INFO("server.loading", "Loading GameObject models..."); if (!LoadGameObjectModelList(m_dataPath)) { TC_LOG_FATAL("server.loading", "Unable to load gameobject models (part of vmaps), objects using WMO models will crash the client - server shutting down!"); - exit(1); + return false; } TC_LOG_INFO("misc", "Loading hotfix blobs..."); @@ -2533,6 +2533,7 @@ void World::SetInitialWorldSettings() TC_LOG_INFO("server.worldserver", "World initialized in {} minutes {} seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); TC_METRIC_EVENT("events", "World initialized", "World initialized in " + std::to_string(startupDuration / 60000) + " minutes " + std::to_string((startupDuration % 60000) / 1000) + " seconds"); + return true; } void World::SetForcedWarModeFactionBalanceState(TeamId team, int32 reward) diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 7c7dcbb5cfc..80bd856a94a 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -648,7 +648,7 @@ class TC_GAME_API World return lvl > 60 ? 300 + ((lvl - 60) * 75) / 10 : lvl * 5; } - void SetInitialWorldSettings(); + bool SetInitialWorldSettings(); void LoadConfigSettings(bool reload = false); void SendWorldText(uint32 string_id, ...); |
