diff options
author | Shauren <shauren.trinity@gmail.com> | 2024-11-12 16:39:24 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2024-11-12 16:39:24 +0100 |
commit | 4e551741cf893a96bee66c063d4e028df7a11adf (patch) | |
tree | b1e31bfe60bf36931b00cb5f6eb620bdf39ba531 /src/server/game/Spells/Auras | |
parent | af4dcc93ed04c4f2219c14821b25cb9efeb7e781 (diff) |
Core/Misc: Fix some GCC warnings
Diffstat (limited to 'src/server/game/Spells/Auras')
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 42 |
1 files changed, 11 insertions, 31 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 14b3e40b3ed..db893f4b379 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1644,14 +1644,14 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode return; Unit* target = aurApp->GetTarget(); - Player* playerTarget = target->ToPlayer(); InvisibilityType type = InvisibilityType(GetMiscValue()); if (apply) { // apply glow vision - if (playerTarget && type == INVISIBILITY_GENERAL) - playerTarget->AddAuraVision(PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); + if (type == INVISIBILITY_GENERAL) + if (Player* playerTarget = target->ToPlayer()) + playerTarget->AddAuraVision(PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); target->m_invisibility.AddFlag(type); target->m_invisibility.AddValue(type, GetAmount()); @@ -1660,39 +1660,19 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode } else { - if (!target->HasAuraType(SPELL_AURA_MOD_INVISIBILITY)) + if (!target->HasAuraTypeWithMiscvalue(SPELL_AURA_MOD_INVISIBILITY, type)) { - // if not have different invisibility auras. - // always remove glow vision - if (Player * playerTarget = target->ToPlayer()) - playerTarget->RemoveAuraVision(PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); + // if not have invisibility auras of type INVISIBILITY_GENERAL + // remove glow vision + if (type == INVISIBILITY_GENERAL) + if (Player* playerTarget = target->ToPlayer()) + playerTarget->RemoveAuraVision(PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); target->m_invisibility.DelFlag(type); - - target->RemoveVisFlag(UNIT_VIS_FLAGS_INVISIBLE); } - else - { - bool found = false; - Unit::AuraEffectList const& invisAuras = target->GetAuraEffectsByType(SPELL_AURA_MOD_INVISIBILITY); - for (Unit::AuraEffectList::const_iterator i = invisAuras.begin(); i != invisAuras.end(); ++i) - { - if (GetMiscValue() == (*i)->GetMiscValue()) - { - found = true; - break; - } - } - if (!found) - { - // if not have invisibility auras of type INVISIBILITY_GENERAL - // remove glow vision - if (playerTarget && type == INVISIBILITY_GENERAL) - playerTarget->RemoveAuraVision(PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); - target->m_invisibility.DelFlag(type); - } - } + if (!target->HasAuraType(SPELL_AURA_MOD_INVISIBILITY)) + target->RemoveVisFlag(UNIT_VIS_FLAGS_INVISIBLE); target->m_invisibility.AddValue(type, -GetAmount()); } |