*Backport some contents from TC2.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-04-04 20:31:29 -06:00
parent 574a9bb88e
commit 9a03bb1e5f
8 changed files with 95 additions and 505 deletions

View File

@@ -628,8 +628,8 @@ void Map::RelocationNotify()
if(unit->m_Notified || !unit->IsInWorld() || unit->GetMapId() != GetId())
continue;
unit->m_IsInNotifyList = false;
unit->m_Notified = true;
unit->m_IsInNotifyList = false;
if(unit->GetTypeId() == TYPEID_PLAYER)
{
@@ -1480,8 +1480,8 @@ bool Map::CheckGridIntegrity(Creature* c, bool moved) const
Cell xy_cell(xy_val);
if(xy_cell != cur_cell)
{
sLog.outDebug("ERROR: %s (GUID: %u) X: %f Y: %f (%s) in grid[%u,%u]cell[%u,%u] instead grid[%u,%u]cell[%u,%u]",
(c->GetTypeId()==TYPEID_PLAYER ? "Player" : "Creature"),c->GetGUIDLow(),
sLog.outDebug("Creature (GUIDLow: %u) X: %f Y: %f (%s) in grid[%u,%u]cell[%u,%u] instead grid[%u,%u]cell[%u,%u]",
c->GetGUIDLow(),
c->GetPositionX(),c->GetPositionY(),(moved ? "final" : "original"),
cur_cell.GridX(), cur_cell.GridY(), cur_cell.CellX(), cur_cell.CellY(),
xy_cell.GridX(), xy_cell.GridY(), xy_cell.CellX(), xy_cell.CellY());
@@ -2188,12 +2188,14 @@ void BattleGroundMap::UnloadAll()
{
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->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();
}
}
Map::UnloadAll();