diff options
Diffstat (limited to 'src/server/game/Instances/InstanceSaveMgr.cpp')
-rw-r--r-- | src/server/game/Instances/InstanceSaveMgr.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index a6690a7e0b3..e37e6847bdd 100644 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -161,6 +161,12 @@ void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId) } } +void InstanceSaveManager::UnloadInstanceSave(uint32 InstanceId) +{ + if (InstanceSave* save = GetInstanceSave(InstanceId)) + save->UnloadIfEmpty(); +} + InstanceSave::InstanceSave(uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, bool canReset) : m_resetTime(resetTime), m_instanceid(InstanceId), m_mapid(MapId), m_difficulty(difficulty), m_canReset(canReset), m_toDelete(false) { } @@ -232,6 +238,11 @@ bool InstanceSave::UnloadIfEmpty() { if (m_playerList.empty() && m_groupList.empty()) { + // don't remove the save if there are still players inside the map + if (Map* map = sMapMgr->FindMap(GetMapId(), GetInstanceId())) + if (map->HavePlayers()) + return true; + if (!sInstanceSaveMgr->lock_instLists) sInstanceSaveMgr->RemoveInstanceSave(GetInstanceId()); |