Merge pull request #4641 from Subv/fix001

Core/Vehicles: Vehicles with SAI should not kick their passengers when resetting
This commit is contained in:
Shocker
2012-01-05 19:20:13 -08:00
2 changed files with 27 additions and 1 deletions

View File

@@ -431,12 +431,36 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
MovepointReached(Data);
}
void SmartAI::RemoveAuras()
{
Unit::AuraApplicationMap appliedAuras = me->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator iter = appliedAuras.begin(); iter != appliedAuras.end();)
{
Aura const* aura = iter->second->GetBase();
if (!aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE) && !(iter->second->GetTarget() == me && aura->GetCaster() == me))
me->_UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT);
else
++iter;
}
Unit::AuraMap ownedAuras = me->GetOwnedAuras();
for (Unit::AuraMap::iterator iter = ownedAuras.begin(); iter != ownedAuras.end();)
{
Aura* aura = iter->second;
if (!aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE))
me->RemoveOwnedAura(iter, AURA_REMOVE_BY_DEFAULT);
else
++iter;
}
}
void SmartAI::EnterEvadeMode()
{
if (!me->isAlive())
return;
me->RemoveAllAuras();
RemoveAuras();
me->DeleteThreatList();
me->CombatStop(true);
me->LoadCreaturesAddon();

View File

@@ -193,6 +193,8 @@ class SmartAI : public CreatureAI
mDespawnState = t ? 1 : 0;
}
void StartDespawn() { mDespawnState = 2; }
void RemoveAuras();
private:
uint32 mFollowCreditType;