aboutsummaryrefslogtreecommitdiff
path: root/src/game/Map.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-06 16:14:13 -0500
committermegamage <none@none>2009-08-06 16:14:13 -0500
commitbefbae3a61c50252c1b56466dc23aa166167fc6b (patch)
tree58cb214e2da93bf4fac879a503ce339112fd3cb3 /src/game/Map.cpp
parent50c73d433ce54b5c119058ee295d0ffaa5ac95bc (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/Map.cpp')
-rw-r--r--src/game/Map.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index 7b2b846c6e7..85a720948ab 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -1196,6 +1196,21 @@ bool Map::UnloadGrid(const uint32 &x, const uint32 &y, bool unloadAll)
return true;
}
+void Map::RemoveAllPlayers()
+{
+ if(HavePlayers())
+ {
+ sLog.outError("Map::UnloadAll: there are still players in the instance at unload, should not happen!");
+
+ for(MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
+ {
+ Player* plr = itr->getSource();
+ if(!plr->IsBeingTeleportedFar())
+ plr->TeleportTo(plr->m_homebindMapId, plr->m_homebindX, plr->m_homebindY, plr->m_homebindZ, plr->GetOrientation());
+ }
+ }
+}
+
void Map::UnloadAll()
{
// clear all delayed moves, useless anyway do this moves before map unload.
@@ -2642,12 +2657,7 @@ void InstanceMap::PermBindAllPlayers(Player *player)
void InstanceMap::UnloadAll()
{
- while(HavePlayers())
- {
- sLog.outError("InstanceMap::UnloadAll: there are still players in the instance at unload, should not happen!");
- Player *plr = m_mapRefManager.getFirst()->getSource();
- plr->TeleportOutOfMap(this);
- }
+ assert(!HavePlayers());
if(m_resetAfterUnload == true)
objmgr.DeleteRespawnTimeForInstance(GetInstanceId());
@@ -2734,16 +2744,17 @@ void BattleGroundMap::SetUnload()
m_unloadTimer = MIN_UNLOAD_DELAY;
}
-void BattleGroundMap::UnloadAll()
+void BattleGroundMap::RemoveAllPlayers()
{
- while(HavePlayers())
+ if(HavePlayers())
{
- Player *plr = m_mapRefManager.getFirst()->getSource();
- plr->TeleportTo(plr->GetBattleGroundEntryPoint());
- plr->TeleportOutOfMap(this);
+ for(MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
+ {
+ Player* plr = itr->getSource();
+ if(!plr->IsBeingTeleportedFar())
+ plr->TeleportTo(plr->GetBattleGroundEntryPoint());
+ }
}
-
- Map::UnloadAll();
}
/// Put scripts in the execution queue