mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-25 19:31:59 +01:00
[7254] Cleanups and batter checking in homebind/bgEntryPoint code.
* Load homebind data early in Player::LoadFromDB and use instead initital race points
in cases need some safe point if current coordinate broken by some reason.
* Store BG entry point in to WorldLocation and simplify calls.
* Set bg entry point at GM teleports to battleground for correct
auto-recall position at battleground end.
Author: VladimirMangos
--HG--
branch : trunk
This commit is contained in:
@@ -2147,12 +2147,14 @@ void BattleGroundMap::UnloadAll(bool pForce)
|
||||
{
|
||||
while(HavePlayers())
|
||||
{
|
||||
Player * plr = m_mapRefManager.getFirst()->getSource();
|
||||
if(plr) (plr)->TeleportTo(plr->m_homebindMapId, plr->m_homebindX, plr->m_homebindY, plr->m_homebindZ, plr->GetOrientation());
|
||||
// TeleportTo removes the player from this map (if the map exists) -> calls BattleGroundMap::Remove -> invalidates the iterator.
|
||||
// just in case, remove the player from the list explicitly here as well to prevent a possible infinite loop
|
||||
// note that this remove is not needed if the code works well in other places
|
||||
plr->GetMapRef().unlink();
|
||||
if(Player * plr = m_mapRefManager.getFirst()->getSource())
|
||||
{
|
||||
plr->TeleportTo(plr->GetBattleGroundEntryPoint());
|
||||
// TeleportTo removes the player from this map (if the map exists) -> calls BattleGroundMap::Remove -> invalidates the iterator.
|
||||
// just in case, remove the player from the list explicitly here as well to prevent a possible infinite loop
|
||||
// note that this remove is not needed if the code works well in other places
|
||||
plr->GetMapRef().unlink();
|
||||
}
|
||||
}
|
||||
|
||||
Map::UnloadAll(pForce);
|
||||
|
||||
Reference in New Issue
Block a user