Core/Vehicles
* Fixed crash happening when passenger died on vehicle he was controlling * Fixed crash happening if vehicle control aura was removed before passenger is fully added to vehicle Closes #7160
This commit is contained in:
1 parent
a0f4937fbc
commit
2c169bcca5
6 files changed
+40
-3
No files matched your search
@@ -1294,8 +1294,8 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint3
|
||||
if (!UpdateEntry(Entry, team, data))
|
||||
return false;
|
||||
|
||||
if (vehId && !CreateVehicleKit(vehId, Entry))
|
||||
vehId = 0;
|
||||
if (vehId)
|
||||
CreateVehicleKit(vehId, Entry);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25689,6 +25689,7 @@ void Player::ActivateSpec(uint8 spec)
|
||||
ClearComboPointHolders();
|
||||
ClearAllReactives();
|
||||
UnsummonAllTotems();
|
||||
ExitVehicle();
|
||||
RemoveAllControlled();
|
||||
/*RemoveAllAurasOnDeath();
|
||||
if (GetPet())
|
||||
|
||||
@@ -12419,6 +12419,9 @@ void Unit::setDeathState(DeathState s)
|
||||
if (IsNonMeleeSpellCasted(false))
|
||||
InterruptNonMeleeSpells(false);
|
||||
|
||||
ExitVehicle(); // Exit vehicle before calling RemoveAllControlled
|
||||
// vehicles use special type of charm that is not removed by the next function
|
||||
// triggering an assert
|
||||
UnsummonAllTotems();
|
||||
RemoveAllControlled();
|
||||
RemoveAllAurasOnDeath();
|
||||
@@ -16842,7 +16845,10 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a
|
||||
if (Player* player = ToPlayer())
|
||||
{
|
||||
if (vehicle->GetBase()->GetTypeId() == TYPEID_PLAYER && player->isInCombat())
|
||||
{
|
||||
vehicle->GetBase()->RemoveAura(const_cast<AuraApplication*>(aurApp));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT(!m_vehicle);
|
||||
|
||||
@@ -744,6 +744,31 @@ void Vehicle::RemovePendingEventsForSeat(int8 seatId)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn void Vehicle::RemovePendingEventsForSeat(uint8 seatId)
|
||||
*
|
||||
* @brief Removes any pending events for given passenger. Executed when vehicle control aura is removed while adding passenger is in progress
|
||||
*
|
||||
* @author Shauren
|
||||
* @date 13-2-2013
|
||||
*
|
||||
* @param passenger Unit that is supposed to enter the vehicle.
|
||||
*/
|
||||
|
||||
void Vehicle::RemovePendingEventsForPassenger(Unit* passenger)
|
||||
{
|
||||
for (PendingJoinEventContainer::iterator itr = _pendingJoinEvents.begin(); itr != _pendingJoinEvents.end();)
|
||||
{
|
||||
if ((*itr)->Passenger == passenger)
|
||||
{
|
||||
(*itr)->to_Abort = true;
|
||||
_pendingJoinEvents.erase(itr++);
|
||||
}
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
VehicleJoinEvent::~VehicleJoinEvent()
|
||||
{
|
||||
if (Target)
|
||||
@@ -769,6 +794,7 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
|
||||
{
|
||||
ASSERT(Passenger->IsInWorld());
|
||||
ASSERT(Target && Target->GetBase()->IsInWorld());
|
||||
ASSERT(Target->GetBase()->HasAuraTypeWithCaster(SPELL_AURA_CONTROL_VEHICLE, Passenger->GetGUID()));
|
||||
|
||||
Target->RemovePendingEventsForSeat(Seat->first);
|
||||
|
||||
|
||||
@@ -71,6 +71,8 @@ class Vehicle : public TransportBase
|
||||
|
||||
VehicleSeatEntry const* GetSeatForPassenger(Unit const* passenger) const;
|
||||
|
||||
void RemovePendingEventsForPassenger(Unit* passenger);
|
||||
|
||||
protected:
|
||||
friend class VehicleJoinEvent;
|
||||
uint32 UsableSeatNum; ///< Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags
|
||||
|
||||
@@ -2323,7 +2323,7 @@ void AuraEffect::HandleAuraModPacifyAndSilence(AuraApplication const* aurApp, ui
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
// Vengeance of the Blue Flight (@todo REMOVE THIS!)
|
||||
/// @workaround
|
||||
/// @workaround
|
||||
if (m_spellInfo->Id == 45839)
|
||||
{
|
||||
if (apply)
|
||||
@@ -2935,6 +2935,8 @@ void AuraEffect::HandleAuraControlVehicle(AuraApplication const* aurApp, uint8 m
|
||||
caster->_ExitVehicle();
|
||||
// some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
|
||||
caster->RemoveAurasDueToSpell(GetId());
|
||||
|
||||
target->GetVehicleKit()->RemovePendingEventsForPassenger(caster);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user