diff options
author | jackpoz <giacomopoz@gmail.com> | 2014-01-03 18:09:52 +0100 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2014-01-03 18:56:11 +0100 |
commit | 1f170c99efec6c89b9a454a3aa17511341f61659 (patch) | |
tree | 3fa4dd1ce0f93848572573244d8fe385fa646f13 /src/server/game/Instances/InstanceSaveMgr.cpp | |
parent | 9d6904f03d67e6feddcbd77f9d74cd4f3b9c38ad (diff) |
Core/Instances: Fix Instance binding
Fix players not being bound to instance if the group was disbanded before killing any boss.
Fixes #437
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()); |