From be01821050dd30ff65e89b347d528efb20aba028 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 19 Apr 2010 17:03:10 +0200 Subject: More warning removal (Some code modifications and cleanup when needed) --HG-- branch : trunk --- src/game/Unit.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/game/Unit.cpp') diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 397a6ffccc5..566112eacd3 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3631,8 +3631,8 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo } bool auraStateFound = false; - AuraState auraState; - if (auraState = GetSpellAuraState(aura->GetSpellProto())) + AuraState auraState = GetSpellAuraState(aura->GetSpellProto()); + if (auraState) { bool canBreak = false; // Get mask of all aurastates from remaining auras @@ -5950,7 +5950,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger if ((*i)->GetEffIndex() != 0) continue; basepoints0 = int32((*i)->GetAmount()); - if (target = GetGuardianPet()) + target = GetGuardianPet(); + if (target) { // regen mana for pet CastCustomSpell(target,54607,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); @@ -12111,10 +12112,10 @@ Unit* Creature::SelectVictim() const AuraEffectList& tauntAuras = GetAuraEffectsByType(SPELL_AURA_MOD_TAUNT); if (!tauntAuras.empty()) { - Unit* caster; + Unit* caster = tauntAuras.back()->GetCaster(); // The last taunt aura caster is alive an we are happy to attack him - if ((caster = tauntAuras.back()->GetCaster()) && caster->isAlive()) + if (caster && caster->isAlive()) return getVictim(); else if (tauntAuras.size() > 1) { @@ -12126,8 +12127,8 @@ Unit* Creature::SelectVictim() do { --aura; - if ((caster = (*aura)->GetCaster()) && - caster->IsInMap(this) && canAttack(caster) && caster->isInAccessiblePlaceFor(this->ToCreature())) + caster = (*aura)->GetCaster(); + if (caster && caster->IsInMap(this) && canAttack(caster) && caster->isInAccessiblePlaceFor(this->ToCreature())) { target = caster; break; @@ -12194,9 +12195,11 @@ Unit* Creature::SelectVictim() // search nearby enemy before enter evade mode if (HasReactState(REACT_AGGRESSIVE)) - if (target = SelectNearestTarget()) - if (_IsTargetAcceptable(target)) + { + target = SelectNearestTarget(); + if (target && _IsTargetAcceptable(target)) return target; + } if (m_invisibilityMask) { @@ -13221,7 +13224,7 @@ void CharmInfo::InitCharmCreateSpells() { m_charmspells[x].SetActionAndType(spellId,ACT_DISABLED); - ActiveStates newstate; + ActiveStates newstate = ACT_PASSIVE; if (spellInfo) { if (!IsAutocastableSpell(spellId)) -- cgit v1.2.3