mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Core/Vehicles: Prevent infinite loop in VehicleJoinEvent:Abort
This commit is contained in:
@@ -811,6 +811,11 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
|
||||
|
||||
void VehicleJoinEvent::Abort(uint64)
|
||||
{
|
||||
// Prevent recursion
|
||||
if (_executedAbort)
|
||||
return;
|
||||
|
||||
_executedAbort = true;
|
||||
sLog->outDebug(LOG_FILTER_VEHICLES, "Passenger GuidLow: %u, Entry: %u, board on vehicle GuidLow: %u, Entry: %u SeatId: %i cancelled",
|
||||
Passenger->GetGUIDLow(), Passenger->GetEntry(), Target->GetBase()->GetGUIDLow(), Target->GetBase()->GetEntry(), (int32)Seat->first);
|
||||
|
||||
|
||||
@@ -107,12 +107,15 @@ class VehicleJoinEvent : public BasicEvent
|
||||
{
|
||||
friend class Vehicle;
|
||||
protected:
|
||||
VehicleJoinEvent(Vehicle* v, Unit* u) : Target(v), Passenger(u), Seat(Target->Seats.end()) {}
|
||||
VehicleJoinEvent(Vehicle* v, Unit* u) : Target(v), Passenger(u), Seat(Target->Seats.end()), _executedAbort(false) {}
|
||||
bool Execute(uint64, uint32);
|
||||
void Abort(uint64);
|
||||
|
||||
Vehicle* Target;
|
||||
Unit* Passenger;
|
||||
SeatMap::iterator Seat;
|
||||
|
||||
private:
|
||||
bool _executedAbort;
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user