From ba835f1d30da57d27d28365ab8462993b2f7bfed Mon Sep 17 00:00:00 2001 From: balrok Date: Wed, 9 Dec 2009 22:10:37 +0100 Subject: [PATCH] [8960] fix crash introduced with 8805 or actualy i didn't introduce a new crash there.. the old crash just changed a bit.. after we force the player to logout without valid mapcoords the player wasn't in world anymore and through that Getplayer()->GetMap()->RemoveFromWorld() caused a crash.. i changed now the error handling inside farteleport there.. instead of forcing a logout without saving, i just port him to his homebind which will be much nicer (minor cleanup with the other homebind teleportation.. we don't need to check for the error there.. homebind realy should be a valid coord) --- src/game/MovementHandler.cpp | 20 ++++++++------------ src/shared/revision_nr.h | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 5853824ef..e9653c178 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -50,12 +50,12 @@ void WorldSession::HandleMoveWorldportAckOpcode() // possible errors in the coordinate validity check if(!MapManager::IsValidMapCoord(loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation)) { - sLog.outError("WorldSession::HandleMoveWorldportAckOpcode: player got's teleported far to a not valid location. (map:%u, x:%f, y:%f, z:%f) We log him out and don't save him..", loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z); - // stop teleportation else we would try this again in the beginning of WorldSession::LogoutPlayer... + sLog.outError("WorldSession::HandleMoveWorldportAckOpcode: player %s (%d) was teleported far to a not valid location. (map:%u, x:%f, y:%f, " + "z:%f) We port him to his homebind instead..", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z); + // stop teleportation else we would try this again and again in LogoutPlayer... GetPlayer()->SetSemaphoreTeleportFar(false); - // player don't gets saved - so his coords will stay at the point where - // he was last saved - LogoutPlayer(false); + // and teleport the player to a valid place + GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()); return; } @@ -81,14 +81,10 @@ void WorldSession::HandleMoveWorldportAckOpcode() //if player wasn't added to map, reset his map pointer! GetPlayer()->ResetMap(); - sLog.outDebug("WORLD: teleport of player %s (%d) to location %d, %f, %f, %f, %f failed", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation); + sLog.outError("WorldSession::HandleMoveWorldportAckOpcode: player %s (%d) was teleported far but couldn't be added to map. (map:%u, x:%f, y:%f, " + "z:%f) We port him to his homebind instead..", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z); // teleport the player home - if(!GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation())) - { - // the player must always be able to teleport home - sLog.outError("WORLD: failed to teleport player %s (%d) to homebind location %d, %f, %f, %f, %f!", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()); - assert(false); - } + GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()); return; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 59fcd9997..b2aec0f90 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8959" + #define REVISION_NR "8960" #endif // __REVISION_NR_H__