aboutsummaryrefslogtreecommitdiff
path: root/src/game/MovementHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/MovementHandler.cpp')
-rw-r--r--src/game/MovementHandler.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp
index 0890ade01f3..08c884c7c55 100644
--- a/src/game/MovementHandler.cpp
+++ b/src/game/MovementHandler.cpp
@@ -67,18 +67,17 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->SetSemaphoreTeleportFar(false);
// relocate the player to the teleport destination
- GetPlayer()->SetMapId(loc.mapid);
+ GetPlayer()->SetMap(MapManager::Instance().CreateMap(loc.mapid, GetPlayer())); GetPlayer()->Relocate(loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation);
GetPlayer()->Relocate(loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation);
- // since the MapId is set before the GetInstance call, the InstanceId must be set to 0
- // to let GetInstance() determine the proper InstanceId based on the player's binds
- GetPlayer()->SetInstanceId(0);
-
GetPlayer()->SendInitialPacketsBeforeAddToMap();
// the CanEnter checks are done in TeleporTo but conditions may change
// while the player is in transit, for example the map may get full
if(!GetPlayer()->GetMap()->Add(GetPlayer()))
{
+ //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);
// teleport the player home
if(!GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()))