*Try to fix the crash caused by invalid map pointer of player.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-08-06 10:21:10 -05:00
parent d4dca0c8cd
commit 048665a37a
3 changed files with 22 additions and 14 deletions
+15
View File
@@ -1621,6 +1621,21 @@ void Player::SendTeleportAckMsg()
GetSession()->SendPacket(&data);
}
void Player::TeleportOutOfMap(Map *oldMap)
{
if(FindMap() != oldMap)
return;
TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, GetOrientation());
if(FindMap() == oldMap)
{
sLog.outCrash("Cannot teleport player out of map!");
ResetMap();
assert(false);
}
}
bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options)
{
if(!MapManager::IsValidMapCoord(mapid, x, y, z, orientation))