Core/Vehicles: Prevent infinite loop in VehicleJoinEvent:Abort

This commit is contained in:
Machiavelli
2013-02-18 02:20:42 +01:00
parent 9004d39c09
commit cc8d5a3aca
2 changed files with 9 additions and 1 deletions

View File

@@ -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);

View File

@@ -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