*A hacky fix of the crash happening when player is teleported during logout.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-08-13 10:01:00 -05:00
parent 5ab3117c0c
commit 284b0063a8
3 changed files with 13 additions and 5 deletions
@@ -282,9 +282,9 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI
void JustDied(Unit* Killer) void JustDied(Unit* Killer)
{ {
Unit *Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100); Creature *Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100);
if(Shaffar) if(Shaffar)
CAST_AI(boss_nexusprince_shaffarAI, (CAST_CRE(Shaffar)->AI()))->RemoveBeaconFromList(m_creature); CAST_AI(boss_nexusprince_shaffarAI, Shaffar->AI())->RemoveBeaconFromList(m_creature);
} }
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
@@ -294,7 +294,7 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI
if(Check_Timer < diff) if(Check_Timer < diff)
{ {
Unit *Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100); Creature *Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100);
if(!Shaffar || Shaffar->isDead() || !Shaffar->isInCombat()) if(!Shaffar || Shaffar->isDead() || !Shaffar->isInCombat())
{ {
KillSelf(); KillSelf();
+7
View File
@@ -67,6 +67,13 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->SetSemaphoreTeleportFar(false); GetPlayer()->SetSemaphoreTeleportFar(false);
Map * oldMap = GetPlayer()->GetMap(); 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 // relocate the player to the teleport destination
Map * newMap = MapManager::Instance().CreateMap(loc.mapid, GetPlayer(), 0); Map * newMap = MapManager::Instance().CreateMap(loc.mapid, GetPlayer(), 0);
// the CanEnter checks are done in TeleporTo but conditions may change // the CanEnter checks are done in TeleporTo but conditions may change
+3 -2
View File
@@ -1617,12 +1617,13 @@ void Player::SendTeleportAckMsg()
GetSession()->SendPacket(&data); GetSession()->SendPacket(&data);
} }
// this is not used anywhere
void Player::TeleportOutOfMap(Map *oldMap) void Player::TeleportOutOfMap(Map *oldMap)
{ {
while(IsBeingTeleportedFar()) while(IsBeingTeleportedFar())
GetSession()->HandleMoveWorldportAckOpcode(); GetSession()->HandleMoveWorldportAckOpcode();
if(FindMap() != oldMap) if(GetMap() != oldMap)
return; return;
TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, GetOrientation()); TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, GetOrientation());
@@ -1630,7 +1631,7 @@ void Player::TeleportOutOfMap(Map *oldMap)
while(IsBeingTeleportedFar()) while(IsBeingTeleportedFar())
GetSession()->HandleMoveWorldportAckOpcode(); GetSession()->HandleMoveWorldportAckOpcode();
if(FindMap() == oldMap) if(GetMap() == oldMap)
{ {
sLog.outCrash("Cannot teleport player out of map!"); sLog.outCrash("Cannot teleport player out of map!");
ResetMap(); ResetMap();