diff options
| author | Shauren <shauren.trinity@gmail.com> | 2014-07-17 15:42:57 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2014-07-17 15:42:57 +0200 |
| commit | 7532864264dd3b3b820c4b3c39ee900d5ff7cb0e (patch) | |
| tree | 4c385674de3ef458300a0395ba7e64bafad1d0db /src/server/game/Spells | |
| parent | 345bed25d25d8e269fd7b863cd700d628a9500e0 (diff) | |
Buildsystem/MSVC: Warning fixes
C4800 'type' : forcing value to bool 'true' or 'false' (performance warning)
C4127 conditional expression is constant
Diffstat (limited to 'src/server/game/Spells')
| -rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.h | 6 | ||||
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 12 | ||||
| -rw-r--r-- | src/server/game/Spells/Spell.h | 6 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 14 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellScript.cpp | 2 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellScript.h | 4 |
8 files changed, 24 insertions, 24 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 75dbd457b91..851d992d857 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1036,7 +1036,7 @@ void Aura::SetLoadedState(int32 maxduration, int32 duration, int32 charges, uint if (m_effects[i]) { m_effects[i]->SetAmount(amount[i]); - m_effects[i]->SetCanBeRecalculated(recalculateMask & (1<<i)); + m_effects[i]->SetCanBeRecalculated((recalculateMask & (1 << i)) != 0); m_effects[i]->CalculatePeriodic(caster, false, true); m_effects[i]->CalculateSpellMod(); m_effects[i]->RecalculateAmount(caster); diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 8c426ea2175..19c77c2ac7e 100644 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -67,9 +67,9 @@ class AuraApplication uint8 GetSlot() const { return _slot; } uint8 GetFlags() const { return _flags; } uint8 GetEffectMask() const { return _flags & (AFLAG_EFF_INDEX_0 | AFLAG_EFF_INDEX_1 | AFLAG_EFF_INDEX_2); } - bool HasEffect(uint8 effect) const { ASSERT(effect < MAX_SPELL_EFFECTS); return _flags & (1<<effect); } - bool IsPositive() const { return _flags & AFLAG_POSITIVE; } - bool IsSelfcast() const { return _flags & AFLAG_CASTER; } + bool HasEffect(uint8 effect) const { ASSERT(effect < MAX_SPELL_EFFECTS); return (_flags & (1 << effect)) != 0; } + bool IsPositive() const { return (_flags & AFLAG_POSITIVE) != 0; } + bool IsSelfcast() const { return (_flags & AFLAG_CASTER) != 0; } uint8 GetEffectsToApply() const { return _effectsToApply; } void SetRemoveMode(AuraRemoveMode mode) { _removeMode = mode; } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index d223425a027..2bf9c0e0395 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1759,8 +1759,8 @@ void Spell::SearchTargets(SEARCHER& searcher, uint32 containerMask, Unit* refere return; // search world and grid for possible targets - bool searchInGrid = containerMask & (GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_GAMEOBJECT); - bool searchInWorld = containerMask & (GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER | GRID_MAP_TYPE_MASK_CORPSE); + bool searchInGrid = (containerMask & (GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_GAMEOBJECT)) != 0; + bool searchInWorld = (containerMask & (GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER | GRID_MAP_TYPE_MASK_CORPSE)) != 0; if (searchInGrid || searchInWorld) { float x, y; @@ -2537,7 +2537,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA aura_effmask |= 1 << i; // Get Data Needed for Diminishing Returns, some effects may have multiple auras, so this must be done on spell hit, not aura add - m_diminishGroup = GetDiminishingReturnsGroupForSpell(m_spellInfo, m_triggeredByAuraSpell); + m_diminishGroup = GetDiminishingReturnsGroupForSpell(m_spellInfo, m_triggeredByAuraSpell != nullptr); if (m_diminishGroup && aura_effmask) { m_diminishLevel = unit->GetDiminishing(m_diminishGroup); @@ -5516,7 +5516,7 @@ SpellCastResult Spell::CheckCasterAuras() const mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; } - bool usableInStun = m_spellInfo->AttributesEx5 & SPELL_ATTR5_USABLE_WHILE_STUNNED; + bool usableInStun = (m_spellInfo->AttributesEx5 & SPELL_ATTR5_USABLE_WHILE_STUNNED) != 0; // Glyph of Pain Suppression // there is no other way to handle it @@ -6472,7 +6472,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const bool Spell::IsNextMeleeSwingSpell() const { - return m_spellInfo->Attributes & SPELL_ATTR0_ON_NEXT_SWING; + return (m_spellInfo->Attributes & SPELL_ATTR0_ON_NEXT_SWING) != 0; } bool Spell::IsAutoActionResetSpell() const @@ -6651,7 +6651,7 @@ void Spell::HandleLaunchPhase() if (m_applyMultiplierMask & (1 << i)) multiplier[i] = m_spellInfo->Effects[i].CalcDamageMultiplier(m_originalCaster, this); - bool usesAmmo = m_spellInfo->AttributesCu & SPELL_ATTR0_CU_DIRECT_DAMAGE; + bool usesAmmo = (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_DIRECT_DAMAGE) != 0; Unit::AuraEffectList const& Auras = m_caster->GetAuraEffectsByType(SPELL_AURA_ABILITY_CONSUME_NO_AMMO); for (Unit::AuraEffectList::const_iterator j = Auras.begin(); j != Auras.end(); ++j) { diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 584c20fdfb3..9c4891b95f4 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -150,8 +150,8 @@ class SpellCastTargets void ModDst(SpellDestination const& spellDest); void RemoveDst(); - bool HasSrc() const { return GetTargetMask() & TARGET_FLAG_SOURCE_LOCATION; } - bool HasDst() const { return GetTargetMask() & TARGET_FLAG_DEST_LOCATION; } + bool HasSrc() const { return (GetTargetMask() & TARGET_FLAG_SOURCE_LOCATION) != 0; } + bool HasDst() const { return (GetTargetMask() & TARGET_FLAG_DEST_LOCATION) != 0; } bool HasTraj() const { return m_speed != 0; } float GetElevation() const { return m_elevation; } @@ -466,7 +466,7 @@ class Spell void SetAutoRepeat(bool rep) { m_autoRepeat = rep; } void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; } bool IsNextMeleeSwingSpell() const; - bool IsTriggered() const { return _triggeredCastFlags & TRIGGERED_FULL_MASK; } + bool IsTriggered() const { return (_triggeredCastFlags & TRIGGERED_FULL_MASK) != 0; } bool IsChannelActive() const { return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0; } bool IsAutoActionResetSpell() const; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 4c0d5770cea..66fca8303dc 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -5341,7 +5341,7 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex) // The charges / stack amounts don't count towards the total number of auras that can be dispelled. // Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell // Polymorph instead of 1 / (5 + 1) -> 16%. - bool dispel_charges = aura->GetSpellInfo()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES; + bool dispel_charges = (aura->GetSpellInfo()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES) != 0; uint8 charges = dispel_charges ? aura->GetCharges() : aura->GetStackAmount(); if (charges > 0) steal_list.push_back(std::make_pair(aura, charges)); diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 8034002a470..8d3b37cc1d5 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1007,7 +1007,7 @@ bool SpellInfo::IsTargetingArea() const bool SpellInfo::NeedsExplicitUnitTarget() const { - return GetExplicitTargetMask() & TARGET_FLAG_UNIT_MASK; + return (GetExplicitTargetMask() & TARGET_FLAG_UNIT_MASK) != 0; } bool SpellInfo::NeedsToBeTriggeredByCaster(SpellInfo const* triggeringSpell) const @@ -1048,7 +1048,7 @@ bool SpellInfo::NeedsToBeTriggeredByCaster(SpellInfo const* triggeringSpell) con bool SpellInfo::IsPassive() const { - return Attributes & SPELL_ATTR0_PASSIVE; + return (Attributes & SPELL_ATTR0_PASSIVE) != 0; } bool SpellInfo::IsAutocastable() const @@ -1116,12 +1116,12 @@ bool SpellInfo::IsCooldownStartedOnEvent() const bool SpellInfo::IsDeathPersistent() const { - return AttributesEx3 & SPELL_ATTR3_DEATH_PERSISTENT; + return (AttributesEx3 & SPELL_ATTR3_DEATH_PERSISTENT) != 0; } bool SpellInfo::IsRequiringDeadTarget() const { - return AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS; + return (AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS) != 0; } bool SpellInfo::IsAllowingDeadTarget() const @@ -1155,12 +1155,12 @@ bool SpellInfo::IsPositiveEffect(uint8 effIndex) const bool SpellInfo::IsChanneled() const { - return (AttributesEx & (SPELL_ATTR1_CHANNELED_1 | SPELL_ATTR1_CHANNELED_2)); + return (AttributesEx & (SPELL_ATTR1_CHANNELED_1 | SPELL_ATTR1_CHANNELED_2)) != 0; } bool SpellInfo::NeedsComboPoints() const { - return (AttributesEx & (SPELL_ATTR1_REQ_COMBO_POINTS1 | SPELL_ATTR1_REQ_COMBO_POINTS2)); + return (AttributesEx & (SPELL_ATTR1_REQ_COMBO_POINTS1 | SPELL_ATTR1_REQ_COMBO_POINTS2)) != 0; } bool SpellInfo::IsBreakingStealth() const @@ -1176,7 +1176,7 @@ bool SpellInfo::IsRangedWeaponSpell() const bool SpellInfo::IsAutoRepeatRangedSpell() const { - return AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG; + return (AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG) != 0; } bool SpellInfo::IsAffectedBySpellMods() const diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index c0bcd477e5b..7132e0583e8 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -87,7 +87,7 @@ uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellInfo const* spellEnt bool _SpellScript::EffectHook::IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndex) { - return GetAffectedEffectsMask(spellEntry) & 1<<effIndex; + return (GetAffectedEffectsMask(spellEntry) & 1 << effIndex) != 0; } std::string _SpellScript::EffectHook::EffIndexToString() diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 32b8781fb89..43d8a577fa3 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -256,8 +256,8 @@ class SpellScript : public _SpellScript bool _Validate(SpellInfo const* entry); bool _Load(Spell* spell); void _InitHit(); - bool _IsEffectPrevented(SpellEffIndex effIndex) { return m_hitPreventEffectMask & (1<<effIndex); } - bool _IsDefaultEffectPrevented(SpellEffIndex effIndex) { return m_hitPreventDefaultEffectMask & (1<<effIndex); } + bool _IsEffectPrevented(SpellEffIndex effIndex) { return (m_hitPreventEffectMask & (1 << effIndex)) != 0; } + bool _IsDefaultEffectPrevented(SpellEffIndex effIndex) { return (m_hitPreventDefaultEffectMask & (1 << effIndex)) != 0; } void _PrepareScriptCall(SpellScriptHookType hookType); void _FinishScriptCall(); bool IsInCheckCastHook() const; |
