Skip to content

Commit 7f6026f

Browse files
sipertrukratkosrb
authored andcommitted
fix loading screens on transport when no map switch (lh-server#13)
1 parent cb950a0 commit 7f6026f

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

src/game/Objects/Player.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,18 +1800,20 @@ bool Player::SwitchInstance(uint32 newInstanceId)
18001800

18011801
Map* oldmap = GetMap();
18021802

1803-
// Leave transport
1804-
if (m_transport)
1803+
// Leave transport if absent from new instance
1804+
// normally it should have switched before the player
1805+
if (m_transport && m_transport->GetInstanceId() != newInstanceId)
18051806
{
18061807
m_transport->RemovePassenger(this);
18071808
m_movementInfo.ClearTransportData();
1809+
m_movementInfo.RemoveMovementFlag(MOVEFLAG_ONTRANSPORT);
18081810
}
18091811
// Stop duel
18101812
if (duel)
18111813
if (GameObject* obj = GetMap()->GetGameObject(GetGuidValue(PLAYER_DUEL_ARBITER)))
18121814
DuelComplete(DUEL_FLED);
18131815
// Fix movement flags
1814-
m_movementInfo.RemoveMovementFlag(MOVEFLAG_MASK_MOVING_OR_TURN | MOVEFLAG_ONTRANSPORT);
1816+
m_movementInfo.RemoveMovementFlag(MOVEFLAG_MASK_MOVING_OR_TURN);
18151817

18161818
SetSelectionGuid(ObjectGuid());
18171819
CombatStop();

src/game/Transports/Transport.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ bool Transport::TeleportTransport(uint32 newMapid, float x, float y, float z, fl
280280
{
281281
Map const* oldMap = GetMap();
282282

283-
SetLocationInstanceId(sMapMgr.GetContinentInstanceId(newMapid, x, y));
283+
uint32 newInstanceId = sMapMgr.GetContinentInstanceId(newMapid, x, y);
284+
SetLocationInstanceId(newInstanceId);
284285
Map* newMap = sMapMgr.CreateMap(newMapid, this);
285286
GetMap()->Remove<Transport>(this, false);
286287
SetMap(newMap);
@@ -328,8 +329,17 @@ bool Transport::TeleportTransport(uint32 newMapid, float x, float y, float z, fl
328329
player->RemoveSpellsCausingAura(SPELL_AURA_MOD_FEAR);
329330
player->CombatStopWithPets(true);
330331

331-
player->TeleportTo(newMapid, destX, destY, destZ, destO,
332-
TELE_TO_NOT_LEAVE_TRANSPORT);
332+
// No need for teleport packet if no map change
333+
// The client still shows the correct loading screen when one is needed (Grom'Gol-Undercity)
334+
if (newMapid == player->GetMapId())
335+
{
336+
player->TeleportPositionRelocation(destX, destY, destZ, destO);
337+
if (newInstanceId != player->GetInstanceId())
338+
sMapMgr.ScheduleInstanceSwitch(player, newInstanceId);
339+
}
340+
else
341+
player->TeleportTo(newMapid, destX, destY, destZ, destO,
342+
TELE_TO_NOT_LEAVE_TRANSPORT);
333343

334344
break;
335345
}

0 commit comments

Comments
 (0)