mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Vehicle: delay position update in Vehicles, this may be deleted on UpdatePosition, generating a crash
Closes #17634
(cherry picked from commit 6b3067f978)
# Conflicts:
# src/server/game/Entities/Vehicle/Vehicle.cpp
This commit is contained in:
@@ -521,6 +521,9 @@ void Vehicle::RelocatePassengers()
|
||||
{
|
||||
ASSERT(_me->GetMap());
|
||||
|
||||
std::vector<std::pair<Unit*, Position>> seatRelocation;
|
||||
seatRelocation.reserve(Seats.size());
|
||||
|
||||
// not sure that absolute position calculation is correct, it must depend on vehicle pitch angle
|
||||
for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr)
|
||||
{
|
||||
@@ -532,9 +535,12 @@ void Vehicle::RelocatePassengers()
|
||||
passenger->m_movementInfo.transport.pos.GetPosition(px, py, pz, po);
|
||||
CalculatePassengerPosition(px, py, pz, &po);
|
||||
|
||||
passenger->UpdatePosition(px, py, pz, po);
|
||||
seatRelocation.emplace_back(passenger, Position(px, py, pz, po));
|
||||
}
|
||||
}
|
||||
|
||||
for (auto const& pair : seatRelocation)
|
||||
pair.first->UpdatePosition(pair.second);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user