diff options
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 54d0f54c88f..9b41f52e124 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -382,9 +382,9 @@ void Unit::GetRandomContactPoint( const Unit* obj, float &x, float &y, float &z, float combat_reach = GetCombatReach(); if(combat_reach < 0.1) // sometimes bugged for players { - sLog.outError("Unit %u (Type: %u) has invalid combat_reach %f",GetGUIDLow(),GetTypeId(),combat_reach); - if(GetTypeId() == TYPEID_UNIT) - sLog.outError("Creature entry %u has invalid combat_reach", ((Creature*)this)->GetEntry()); + //sLog.outError("Unit %u (Type: %u) has invalid combat_reach %f",GetGUIDLow(),GetTypeId(),combat_reach); + // if(GetTypeId() == TYPEID_UNIT) + // sLog.outError("Creature entry %u has invalid combat_reach", ((Creature*)this)->GetEntry()); combat_reach = DEFAULT_COMBAT_REACH; } uint32 attacker_number = getAttackers().size(); @@ -3927,6 +3927,11 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) Aura* Aur = i->second; SpellEntry const* AurSpellInfo = Aur->GetSpellProto(); + // some ShapeshiftBoosts at remove trigger removing other auras including parent Shapeshift aura + // remove aura from list before to prevent deleting it before + m_Auras.erase(i); + ++m_removedAuras; // internal count used by unit update + Unit* caster = NULL; if (IsSingleTargetSpell(AurSpellInfo)) { @@ -3946,22 +3951,20 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) // remove from list before mods removing (prevent cyclic calls, mods added before including to aura list - use reverse order) if (Aur->GetModifier()->m_auraname < TOTAL_AURAS) { - m_modAuras[(*i).second->GetModifier()->m_auraname].remove((*i).second); - if((*i).second->GetSpellProto()->AuraInterruptFlags) + m_modAuras[Aur->GetModifier()->m_auraname].remove(Aur); + + if(Aur->GetSpellProto()->AuraInterruptFlags) { - m_interruptableAuras.remove((*i).second); + m_interruptableAuras.remove(Aur); UpdateInterruptMask(); } - if((*i).second->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE) - m_ccAuras.remove((*i).second); + + if(Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE) + m_ccAuras.remove(Aur); } // Set remove mode Aur->SetRemoveMode(mode); - // some ShapeshiftBoosts at remove trigger removing other auras including parent Shapeshift aura - // remove aura from list before to prevent deleting it before - m_Auras.erase(i); - ++m_removedAuras; // internal count used by unit update // Statue unsummoned at aura remove Totem* statue = NULL; @@ -3982,12 +3985,12 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)Aur->GetSpellProto()->Id)) { - for(std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i) + for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) { if(spell_triggered < 0) - RemoveAurasDueToSpell(-(*i)); + RemoveAurasDueToSpell(-(*itr)); else if(Unit* caster = Aur->GetCaster()) - CastSpell(this, *i, true, 0, 0, caster->GetGUID()); + CastSpell(this, *itr, true, 0, 0, caster->GetGUID()); } } @@ -11251,6 +11254,8 @@ bool Unit::HandleMeandingAuraProc( Aura* triggeredByAura ) void Unit::RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo) { uint64 target_guid = GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT); + if(target_guid == GetGUID()) + return; if(!IS_UNIT_GUID(target_guid)) return; |