fix(Core/Vehicle): fix crash when using MC on a player riding a vehicle (#24551)
Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "TemporarySummon.h"
|
||||
#include "Unit.h"
|
||||
#include "Util.h"
|
||||
#include <algorithm>
|
||||
|
||||
Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) :
|
||||
_me(unit), _vehicleInfo(vehInfo), _usableSeatNum(0), _creatureEntry(creatureEntry), _status(STATUS_NONE)
|
||||
@@ -562,6 +563,11 @@ bool Vehicle::IsVehicleInUse()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Vehicle::IsControllableVehicle() const
|
||||
{
|
||||
return std::ranges::any_of(Seats, [](auto const& seat) { return seat.second.SeatInfo->CanControl(); });
|
||||
}
|
||||
|
||||
void Vehicle::TeleportVehicle(float x, float y, float z, float ang)
|
||||
{
|
||||
_me->GetMap()->LoadGrid(x, y);
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
void RemoveAllPassengers();
|
||||
void Dismiss();
|
||||
bool IsVehicleInUse();
|
||||
[[nodiscard]] bool IsControllableVehicle() const;
|
||||
void TeleportVehicle(float x, float y, float z, float ang);
|
||||
|
||||
SeatMap Seats;
|
||||
|
||||
Reference in New Issue
Block a user