*Try to fix a crash caused by single target auras. Thanks to QAston.

--HG--
branch : trunk
This commit is contained in:
megamage committed 2009-08-11 18:26:04 -05:00
1 parent 3078bf6fd0
commit 978242da3f
5 files changed
+28 -21

No files matched your search

+6 -8
View File
@@ -1169,6 +1169,11 @@ void Pet::_LoadAuras(uint32 timediff)
Aura* aura = new Aura(spellproto, effmask, NULL, this, NULL, NULL);
aura->SetLoadedState(caster_guid,maxduration,remaintime,remaincharges, stackcount, &damage[0]);
if(!aura->CanBeSaved())
{
delete aura;
continue;
}
AddAura(aura);
sLog.outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask);
}
@@ -1185,15 +1190,8 @@ void Pet::_SaveAuras()
AuraMap const& auras = GetAuras();
for(AuraMap::const_iterator itr = auras.begin(); itr !=auras.end() ; ++itr)
{
// skip all auras from spell that apply at cast SPELL_AURA_MOD_SHAPESHIFT or pet area auras.
// do not save single target auras (unless they were cast by the player)
if (itr->second->IsPassive() || itr->second->IsAuraType(SPELL_AURA_MOD_STEALTH))
if(!itr->second->CanBeSaved())
continue;
bool isCaster = itr->second->GetCasterGUID() == GetGUID();
if (!isCaster)
if (itr->second->IsSingleTarget()
|| itr->second->IsAreaAura())
continue;
int32 amounts[MAX_SPELL_EFFECTS];
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)