Core/Scripts: Fix a crash when swapping creatures with pending vehicle join events.

* Closes #17833
This commit is contained in:
Naios
2016-09-15 13:08:10 +02:00
committed by Aokromes
parent dcea4223dd
commit 803ec1d5ab
2 changed files with 3 additions and 7 deletions

View File

@@ -737,12 +737,6 @@ void Vehicle::RemovePendingEventsForPassenger(Unit* passenger)
}
}
VehicleJoinEvent::~VehicleJoinEvent()
{
if (Target)
Target->RemovePendingEvent(this);
}
/**
* @fn bool VehicleJoinEvent::Execute(uint64, uint32)
*
@@ -860,6 +854,9 @@ void VehicleJoinEvent::Abort(uint64)
TC_LOG_DEBUG("entities.vehicle", "Passenger GuidLow: %u, Entry: %u, board on vehicle GuidLow: %u, Entry: %u SeatId: %d cancelled",
Passenger->GetGUID().GetCounter(), Passenger->GetEntry(), Target->GetBase()->GetGUID().GetCounter(), Target->GetBase()->GetEntry(), (int32)Seat->first);
/// Remove the pending event when Abort was called on the event directly
Target->RemovePendingEvent(this);
/// @SPELL_AURA_CONTROL_VEHICLE auras can be applied even when the passenger is not (yet) on the vehicle.
/// When this code is triggered it means that something went wrong in @Vehicle::AddPassenger, and we should remove
/// the aura manually.

View File

@@ -123,7 +123,6 @@ class TC_GAME_API VehicleJoinEvent : public BasicEvent
friend class Vehicle;
protected:
VehicleJoinEvent(Vehicle* v, Unit* u) : Target(v), Passenger(u), Seat(Target->Seats.end()) { }
~VehicleJoinEvent();
bool Execute(uint64, uint32) override;
void Abort(uint64) override;