Core/Vehicles:

- Grab correct npc entry from npc_spellclick_spells in case of player vehicle. Fixes DB errors added in my previous changeset
- Allow aura's with SPELL_AURA_CONTROL_VEHICLE to stack if there are enough free seats, even if spellIds are identical.
- Fix a possible infinite loop. Thanks to manuel for spotting
This commit is contained in:
Machiavelli
2011-02-27 03:58:41 +01:00
parent aa2455b586
commit 683cea9e83
11 changed files with 75 additions and 26 deletions
@@ -6594,7 +6594,7 @@ void AuraEffect::HandleAuraSetVehicle(AuraApplication const * aurApp, uint8 mode
if (apply)
{
if (!target->CreateVehicleKit(vehicleId))
if (!target->CreateVehicleKit(vehicleId, 0))
return;
}
else if (target->GetVehicleKit())
+28
View File
@@ -3177,6 +3177,34 @@ bool SpellMgr::CanAurasStack(Aura const *aura1, Aura const *aura2, bool sameCast
}
}
bool isVehicleAura1 = false;
bool isVehicleAura2 = false;
uint8 i = 0;
while (i < MAX_SPELL_EFFECTS && !(isVehicleAura1 && isVehicleAura2))
{
if (spellInfo_1->EffectApplyAuraName[i] == SPELL_AURA_CONTROL_VEHICLE)
isVehicleAura1 = true;
if (spellInfo_2->EffectApplyAuraName[i] == SPELL_AURA_CONTROL_VEHICLE)
isVehicleAura2 = true;
++i;
}
if (isVehicleAura1 && isVehicleAura2)
{
Vehicle* veh = NULL;
if (aura1->GetOwner()->ToUnit())
veh = aura1->GetOwner()->ToUnit()->GetVehicleKit();
if (!veh) // We should probably just let it stack. Vehicle system will prevent undefined behaviour later
return true;
if (!veh->GetAvailableSeatCount())
return false; // No empty seat available
return true; // Empty seat available (skip rest)
}
uint32 spellId_1 = GetLastSpellInChain(spellInfo_1->Id);
uint32 spellId_2 = GetLastSpellInChain(spellInfo_2->Id);