Skip to content

Commit

Permalink
Force transport passengers grid loading if player is present on map t…
Browse files Browse the repository at this point in the history
…raversal
  • Loading branch information
killerwife committed Nov 17, 2023
1 parent bf770ec commit 4f262a2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/game/Entities/Transports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z, fl
Relocate(x, y, z);

bool mapChange = GetMapId() != newMapid;
bool playerPassenger = false;

auto& passengers = GetPassengers();
for (m_passengerTeleportIterator = passengers.begin(); m_passengerTeleportIterator != passengers.end();)
Expand Down Expand Up @@ -316,6 +317,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z, fl
if (player->IsDead() && !player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
player->ResurrectPlayer(1.0);
player->TeleportTo(newMapid, pos.x, pos.y, pos.z, pos.o, TELE_TO_NOT_LEAVE_TRANSPORT, nullptr, this);
playerPassenger = true;
break;
}
case TYPEID_GAMEOBJECT:
Expand Down Expand Up @@ -343,12 +345,14 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z, fl
ResetMap();

Map* newMap = sMapMgr.CreateMap(newMapid, this);
newMap->GetMessager().AddMessage([transport = this](Map* map)
newMap->GetMessager().AddMessage([transport = this, playerPassenger](Map* map)
{
transport->SetMap(map);
transport->Object::AddToWorld();
map->AddTransport(transport);
transport->AddModelToMap();
if (playerPassenger)
map->ForceLoadGrid(transport->GetPositionX(), transport->GetPositionY());
transport->SpawnPassengers();
transport->UpdateForMap(map, true);
});
Expand Down

0 comments on commit 4f262a2

Please sign in to comment.