*A hacky fix of the crash happening when player is teleported during logout.
--HG-- branch : trunk
This commit is contained in:
@@ -67,6 +67,13 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
GetPlayer()->SetSemaphoreTeleportFar(false);
|
||||
|
||||
Map * oldMap = GetPlayer()->GetMap();
|
||||
assert(oldMap);
|
||||
if(GetPlayer()->IsInWorld())
|
||||
{
|
||||
sLog.outCrash("Player is still in world when teleported out of map %u! to new map %u", oldMap->GetId(), loc.mapid);
|
||||
oldMap->Remove(GetPlayer(), false);
|
||||
}
|
||||
|
||||
// relocate the player to the teleport destination
|
||||
Map * newMap = MapManager::Instance().CreateMap(loc.mapid, GetPlayer(), 0);
|
||||
// the CanEnter checks are done in TeleporTo but conditions may change
|
||||
|
||||
+3
-2
@@ -1617,12 +1617,13 @@ void Player::SendTeleportAckMsg()
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
// this is not used anywhere
|
||||
void Player::TeleportOutOfMap(Map *oldMap)
|
||||
{
|
||||
while(IsBeingTeleportedFar())
|
||||
GetSession()->HandleMoveWorldportAckOpcode();
|
||||
|
||||
if(FindMap() != oldMap)
|
||||
if(GetMap() != oldMap)
|
||||
return;
|
||||
|
||||
TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, GetOrientation());
|
||||
@@ -1630,7 +1631,7 @@ void Player::TeleportOutOfMap(Map *oldMap)
|
||||
while(IsBeingTeleportedFar())
|
||||
GetSession()->HandleMoveWorldportAckOpcode();
|
||||
|
||||
if(FindMap() == oldMap)
|
||||
if(GetMap() == oldMap)
|
||||
{
|
||||
sLog.outCrash("Cannot teleport player out of map!");
|
||||
ResetMap();
|
||||
|
||||
Reference in New Issue
Block a user