mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 08:17:56 +00:00
fix (Core/Vehicle): delay position update in Vehicles, this may be deleted (#2247)
This commit is contained in:
@@ -498,19 +498,25 @@ void Vehicle::RelocatePassengers()
|
|||||||
{
|
{
|
||||||
ASSERT(_me->GetMap());
|
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
|
// 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)
|
for (auto const& itr : Seats)
|
||||||
{
|
{
|
||||||
if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger.Guid))
|
if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr.second.Passenger.Guid))
|
||||||
{
|
{
|
||||||
ASSERT(passenger->IsInWorld());
|
ASSERT(passenger->IsInWorld());
|
||||||
|
|
||||||
float px, py, pz, po;
|
float px, py, pz, po;
|
||||||
passenger->m_movementInfo.transport.pos.GetPosition(px, py, pz, po);
|
passenger->m_movementInfo.transport.pos.GetPosition(px, py, pz, po);
|
||||||
CalculatePassengerPosition(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);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vehicle::Dismiss()
|
void Vehicle::Dismiss()
|
||||||
|
|||||||
Reference in New Issue
Block a user