diff options
| author | Shauren <shauren.trinity@gmail.com> | 2022-07-24 18:56:40 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-07-24 18:56:40 +0200 |
| commit | fbe0b8efebca3bc2662b477bdf45627f9783d6c2 (patch) | |
| tree | 6f5662045be0c4e5f06d8a97f9669b7f93cf2df1 /src/server/game/Instances | |
| parent | 8f2c5413d7a3775a304c793653d41caabf3ba997 (diff) | |
Core/Maps: Removed MapInstanced - no longer neccessary for grid data reference counting (moved to TerrainInfo)
Diffstat (limited to 'src/server/game/Instances')
| -rw-r--r-- | src/server/game/Instances/InstanceSaveMgr.cpp | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 6e40a6fc026..b566b4f0cf6 100644 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -28,7 +28,6 @@ #include "InstanceScript.h" #include "Log.h" #include "Map.h" -#include "MapInstanced.h" #include "MapManager.h" #include "ObjectMgr.h" #include "Player.h" @@ -607,7 +606,7 @@ void InstanceSaveManager::_ResetSave(InstanceSaveHashMap::iterator &itr) void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId) { TC_LOG_DEBUG("maps", "InstanceSaveMgr::_ResetInstance %u, %u", mapid, instanceId); - Map const* map = sMapMgr->CreateBaseMap(mapid); + MapEntry const* map = sMapStore.LookupEntry(mapid); if (!map->IsDungeon()) return; @@ -617,7 +616,7 @@ void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId) DeleteInstanceFromDB(instanceId); // even if save not loaded - Map* iMap = ((MapInstanced*)map)->FindInstanceMap(instanceId); + Map* iMap = sMapMgr->FindMap(mapid, instanceId); if (iMap) { ((InstanceMap*)iMap)->Reset(INSTANCE_RESET_RESPAWN_DELAY); @@ -696,28 +695,23 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b } // note: this isn't fast but it's meant to be executed very rarely - Map const* map = sMapMgr->CreateBaseMap(mapid); // _not_ include difficulty - MapInstanced::InstancedMaps &instMaps = ((MapInstanced*)map)->GetInstancedMaps(); - MapInstanced::InstancedMaps::iterator mitr; - uint32 timeLeft; - - for (mitr = instMaps.begin(); mitr != instMaps.end(); ++mitr) + if (mapEntry->IsDungeon()) { - Map* map2 = mitr->second; - if (!map2->IsDungeon()) - continue; - - if (warn) + sMapMgr->DoForAllMapsWithMapId(mapid, [=](Map* map) { - if (now >= resetTime) - timeLeft = 0; - else - timeLeft = uint32(resetTime - now); + if (warn) + { + uint32 timeLeft; + if (now >= resetTime) + timeLeft = 0; + else + timeLeft = uint32(resetTime - now); - ((InstanceMap*)map2)->SendResetWarnings(timeLeft); - } - else - ((InstanceMap*)map2)->Reset(INSTANCE_RESET_GLOBAL); + ((InstanceMap*)map)->SendResetWarnings(timeLeft); + } + else + ((InstanceMap*)map)->Reset(INSTANCE_RESET_GLOBAL); + }); } /// @todo delete creature/gameobject respawn times even if the maps are not loaded |
