diff options
| author | megamage <none@none> | 2009-08-06 16:14:13 -0500 |
|---|---|---|
| committer | megamage <none@none> | 2009-08-06 16:14:13 -0500 |
| commit | befbae3a61c50252c1b56466dc23aa166167fc6b (patch) | |
| tree | 58cb214e2da93bf4fac879a503ce339112fd3cb3 /src/game/MapInstanced.cpp | |
| parent | 50c73d433ce54b5c119058ee295d0ffaa5ac95bc (diff) | |
*Fix the bug that players get stuck after teleported out of bg.
*Do not delete the map immediately until all players are teleported.
--HG--
branch : trunk
Diffstat (limited to 'src/game/MapInstanced.cpp')
| -rw-r--r-- | src/game/MapInstanced.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp index 4817c463f6e..e423abbad31 100644 --- a/src/game/MapInstanced.cpp +++ b/src/game/MapInstanced.cpp @@ -46,7 +46,10 @@ void MapInstanced::Update(const uint32& t) { if(i->second->CanUnload(t)) { - DestroyInstance(i); // iterator incremented + if(!DestroyInstance(i)) // iterator incremented + { + //m_unloadTimer + } } else { @@ -203,16 +206,16 @@ BattleGroundMap* MapInstanced::CreateBattleGround(uint32 InstanceId) return map; } -void MapInstanced::DestroyInstance(uint32 InstanceId) -{ - InstancedMaps::iterator itr = m_InstancedMaps.find(InstanceId); - if(itr != m_InstancedMaps.end()) - DestroyInstance(itr); -} - // increments the iterator after erase -void MapInstanced::DestroyInstance(InstancedMaps::iterator &itr) +bool MapInstanced::DestroyInstance(InstancedMaps::iterator &itr) { + itr->second->RemoveAllPlayers(); + if(itr->second->HavePlayers()) + { + ++itr; + return false; + } + itr->second->UnloadAll(); // should only unload VMaps if this is the last instance and grid unloading is enabled if(m_InstancedMaps.size() <= 1 && sWorld.getConfig(CONFIG_GRID_UNLOAD)) @@ -225,6 +228,7 @@ void MapInstanced::DestroyInstance(InstancedMaps::iterator &itr) // erase map delete itr->second; m_InstancedMaps.erase(itr++); + return true; } bool MapInstanced::CanEnter(Player *player) |
