diff options
| author | Shauren <shauren.trinity@gmail.com> | 2014-10-21 20:27:00 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2025-09-28 22:53:45 +0200 |
| commit | 75f036976410811d3c2629ddcddd279beb2dafb8 (patch) | |
| tree | ecf943b2980591833bff6b49cef7355d1eb76ae9 /src/server/game/Spells/Spell.cpp | |
| parent | d144724e2fd8a74a3e896751dc9c866b3932f815 (diff) | |
Core/Entities: Second batch of removing implicit conversions of ObjectGuid to uint64
(cherry picked from commit 034561792ca9a07d719961ea842af2118428816f)
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index a76bc21d886..7d2ec0adfab 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -98,7 +98,7 @@ SpellDestination::SpellDestination(WorldObject const& wObj) void SpellDestination::Relocate(Position const& pos) { - if (_transportGUID) + if (!_transportGUID.IsEmpty()) { Position offset; _position.GetPositionOffsetTo(pos, offset); @@ -109,7 +109,7 @@ void SpellDestination::Relocate(Position const& pos) void SpellDestination::RelocateOffset(Position const& offset) { - if (_transportGUID) + if (!_transportGUID.IsEmpty()) _transportOffset.RelocateOffset(offset); _position.RelocateOffset(offset); @@ -143,7 +143,7 @@ void SpellCastTargets::Read(ByteBuffer& data, Unit* caster) if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) { data >> m_src._transportGUID.ReadAsPacked(); - if (m_src._transportGUID) + if (!m_src._transportGUID.IsEmpty()) data >> m_src._transportOffset.PositionXYZStream(); else data >> m_src._position.PositionXYZStream(); @@ -151,7 +151,7 @@ void SpellCastTargets::Read(ByteBuffer& data, Unit* caster) else { m_src._transportGUID = caster->GetTransGUID(); - if (m_src._transportGUID) + if (!m_src._transportGUID.IsEmpty()) m_src._transportOffset.Relocate(caster->GetTransOffsetX(), caster->GetTransOffsetY(), caster->GetTransOffsetZ(), caster->GetTransOffsetO()); else m_src._position.Relocate(caster); @@ -160,7 +160,7 @@ void SpellCastTargets::Read(ByteBuffer& data, Unit* caster) if (m_targetMask & TARGET_FLAG_DEST_LOCATION) { data >> m_dst._transportGUID.ReadAsPacked(); - if (m_dst._transportGUID) + if (!m_dst._transportGUID.IsEmpty()) data >> m_dst._transportOffset.PositionXYZStream(); else data >> m_dst._position.PositionXYZStream(); @@ -168,7 +168,7 @@ void SpellCastTargets::Read(ByteBuffer& data, Unit* caster) else { m_dst._transportGUID = caster->GetTransGUID(); - if (m_dst._transportGUID) + if (!m_dst._transportGUID.IsEmpty()) m_dst._transportOffset.Relocate(caster->GetTransOffsetX(), caster->GetTransOffsetY(), caster->GetTransOffsetZ(), caster->GetTransOffsetO()); else m_dst._position.Relocate(caster); @@ -208,7 +208,7 @@ void SpellCastTargets::Write(WorldPackets::Spells::SpellTargetData& data) { data.DstLocation.emplace(); data.DstLocation->Transport = m_dst._transportGUID; - if (m_dst._transportGUID) + if (!m_dst._transportGUID.IsEmpty()) data.DstLocation->Location = m_dst._transportOffset; else data.DstLocation->Location = m_dst._position; @@ -539,7 +539,7 @@ m_caster((info->HasAttribute(SPELL_ATTR6_CAST_BY_CHARMER) && caster->GetCharmerO m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->Damage[0].DamageType); } - if (originalCasterGUID) + if (!originalCasterGUID.IsEmpty()) m_originalCasterGUID = originalCasterGUID; else m_originalCasterGUID = m_caster->GetGUID(); @@ -4690,7 +4690,7 @@ void Spell::SendChannelStart(uint32 duration) unitCaster->SendMessageToSet(&data, true); m_timer = duration; - if (channelTarget) + if (!channelTarget.IsEmpty()) { unitCaster->SetChannelObjectGuid(channelTarget); @@ -4811,7 +4811,8 @@ void Spell::TakePower() { if (powerType == POWER_RAGE || powerType == POWER_ENERGY || powerType == POWER_RUNE) { - if (ObjectGuid targetGUID = m_targets.GetUnitTargetGUID()) + ObjectGuid targetGUID = m_targets.GetUnitTargetGUID(); + if (!targetGUID.IsEmpty()) { auto ihit = std::find_if(std::begin(m_UniqueTargetInfo), std::end(m_UniqueTargetInfo), [&](TargetInfo const& targetInfo) { return targetInfo.TargetGUID == targetGUID && targetInfo.MissCondition != SPELL_MISS_NONE; }); if (ihit != std::end(m_UniqueTargetInfo)) @@ -5780,11 +5781,11 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint switch (SummonProperties->Control) { case SUMMON_CATEGORY_PET: - if (!m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET) && unitCaster->GetPetGUID()) + if (!m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET) && !unitCaster->GetPetGUID().IsEmpty()) return SPELL_FAILED_ALREADY_HAVE_SUMMON; [[fallthrough]]; // check both GetPetGUID() and GetCharmGUID for SUMMON_CATEGORY_PET case SUMMON_CATEGORY_PUPPET: - if (unitCaster->GetCharmedGUID()) + if (!unitCaster->GetCharmedGUID().IsEmpty()) return SPELL_FAILED_ALREADY_HAVE_CHARM; break; } @@ -5796,7 +5797,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint { if (m_targets.GetUnitTarget()->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_BAD_TARGETS; - if (!m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET) && m_targets.GetUnitTarget()->GetPetGUID()) + if (!m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET) && !m_targets.GetUnitTarget()->GetPetGUID().IsEmpty()) return SPELL_FAILED_ALREADY_HAVE_SUMMON; } break; @@ -5807,7 +5808,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint if (!unitCaster) return SPELL_FAILED_BAD_TARGETS; - if (unitCaster->GetPetGUID()) //let warlock do a replacement summon + if (!unitCaster->GetPetGUID().IsEmpty()) //let warlock do a replacement summon { if (unitCaster->GetTypeId() == TYPEID_PLAYER) { @@ -5819,7 +5820,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint return SPELL_FAILED_ALREADY_HAVE_SUMMON; } - if (unitCaster->GetCharmedGUID()) + if (!unitCaster->GetCharmedGUID().IsEmpty()) return SPELL_FAILED_ALREADY_HAVE_CHARM; Player* playerCaster = unitCaster->ToPlayer(); @@ -6002,7 +6003,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint if (!pet) return SPELL_FAILED_NO_PET; - if (pet->GetCharmerGUID()) + if (!pet->GetCharmerGUID().IsEmpty()) return SPELL_FAILED_ALREADY_HAVE_CHARM; break; } @@ -6014,16 +6015,16 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint if (!unitCaster) return SPELL_FAILED_BAD_TARGETS; - if (unitCaster->GetCharmerGUID()) + if (!unitCaster->GetCharmerGUID().IsEmpty()) return SPELL_FAILED_CHARMED; if (spellEffectInfo.ApplyAuraName == SPELL_AURA_MOD_CHARM || spellEffectInfo.ApplyAuraName == SPELL_AURA_MOD_POSSESS) { - if (!m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET) && unitCaster->GetPetGUID()) + if (!m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET) && !unitCaster->GetPetGUID().IsEmpty()) return SPELL_FAILED_ALREADY_HAVE_SUMMON; - if (unitCaster->GetCharmedGUID()) + if (!unitCaster->GetCharmedGUID().IsEmpty()) return SPELL_FAILED_ALREADY_HAVE_CHARM; } @@ -6035,7 +6036,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint if (target->IsMounted()) return SPELL_FAILED_CANT_BE_CHARMED; - if (target->GetCharmerGUID()) + if (!target->GetCharmerGUID().IsEmpty()) return SPELL_FAILED_CANT_BE_CHARMED; if (target->GetOwner() && target->GetOwner()->GetTypeId() == TYPEID_PLAYER) @@ -6664,7 +6665,7 @@ SpellCastResult Spell::CheckItems(uint32* param1 /*= nullptr*/, uint32* param2 / if (!m_CastItem) { - if (m_castItemGUID) + if (!m_castItemGUID.IsEmpty()) return SPELL_FAILED_ITEM_NOT_READY; } else @@ -6735,7 +6736,7 @@ SpellCastResult Spell::CheckItems(uint32* param1 /*= nullptr*/, uint32* param2 / } // check target item - if (m_targets.GetItemTargetGUID()) + if (!m_targets.GetItemTargetGUID().IsEmpty()) { Item* item = m_targets.GetItemTarget(); if (!item) @@ -7400,7 +7401,7 @@ bool Spell::CheckEffectTarget(Unit const* target, SpellEffectInfo const& spellEf return false; if (target->IsMounted()) return false; - if (target->GetCharmerGUID()) + if (!target->GetCharmerGUID().IsEmpty()) return false; if (int32 value = CalculateDamage(spellEffectInfo)) if ((int32)target->GetLevel() > value) |
