diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 81f31bb349..40bef0af09 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -274,7 +274,7 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type) { bool isStatic = false; Creature* creature = NULL; - ASSERT(type <= AV_CPLACE_MAX + AV_STATICCPLACE_MAX); + ASSERT(type < AV_CPLACE_MAX + AV_STATICCPLACE_MAX); if (type >= AV_CPLACE_MAX) //static { type -= AV_CPLACE_MAX; diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp index f015f73205..222bdaf34c 100644 --- a/src/server/game/Calendar/CalendarMgr.cpp +++ b/src/server/game/Calendar/CalendarMgr.cpp @@ -662,6 +662,6 @@ void CalendarMgr::SendPacketToAllEventRelatives(WorldPacket& packet, CalendarEve CalendarInviteStore invites = _invites[calendarEvent.GetEventId()]; for (CalendarInviteStore::iterator itr = invites.begin(); itr != invites.end(); ++itr) if (Player* player = ObjectAccessor::FindConnectedPlayer((*itr)->GetInviteeGUID())) - if (!calendarEvent.IsGuildEvent() || (calendarEvent.IsGuildEvent() && player->GetGuildId() != calendarEvent.GetGuildId())) + if (!calendarEvent.IsGuildEvent() || player->GetGuildId() != calendarEvent.GetGuildId()) player->SendDirectMessage(&packet); } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 64f0d4391e..fdd5b5aded 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -374,7 +374,7 @@ bool Creature::InitEntry(uint32 entry, CreatureData const* data /*= nullptr*/) // Load creature equipment if (!data || data->equipmentId == 0) LoadEquipment(); // use default equipment (if available) - else if (data && data->equipmentId != 0) // override, 0 means no equipment + else // override, 0 means no equipment { m_originalEquipmentId = data->equipmentId; LoadEquipment(data->equipmentId); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 154d016474..5ed13b49bd 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -3871,7 +3871,7 @@ void Player::RemoveSpell(uint32 spell_id, bool disabled, bool learn_low_rank) } // now re-learn if need re-activate - if (cur_active && !prev_itr->second->active && learn_low_rank) + if (!prev_itr->second->active && learn_low_rank) { if (AddSpell(prev_id, true, false, prev_itr->second->dependent, prev_itr->second->disabled)) { @@ -4195,7 +4195,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell if (uint32 prevSpell = sSpellMgr->GetPrevSpellInChain(trainer_spell->ReqAbility[i])) { // check prev.rank requirement - if (prevSpell && !HasSpell(prevSpell)) + if (!HasSpell(prevSpell)) return TRAINER_SPELL_RED; } @@ -9665,7 +9665,7 @@ void Player::SetVirtualItemSlot(uint8 i, Item* item) return; if (charges > 1) item->SetEnchantmentCharges(TEMP_ENCHANTMENT_SLOT, charges-1); - else if (charges <= 1) + else { ApplyEnchantment(item, TEMP_ENCHANTMENT_SLOT, false); item->ClearEnchantment(TEMP_ENCHANTMENT_SLOT); @@ -12328,7 +12328,7 @@ void Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, bool { if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { - if (item && item->GetEntry() == itemEntry && !item->IsInTrade()) + if (item->GetEntry() == itemEntry && !item->IsInTrade()) { if (item->GetCount() + remcount <= count) { @@ -12962,7 +12962,7 @@ void Player::SwapItem(uint16 src, uint16 dst) } } - if (!released && IsBagPos(dst) && pDstItem) + if (!released && IsBagPos(dst)) { Bag* bag = pDstItem->ToBag(); for (uint32 i = 0; i < bag->GetBagSize(); ++i) @@ -13376,7 +13376,7 @@ void Player::AddEnchantmentDuration(Item* item, EnchantmentSlot slot, uint32 dur break; } } - if (item && duration > 0) + if (duration > 0) { GetSession()->SendItemEnchantTimeUpdate(GetGUID(), item->GetGUID(), slot, uint32(duration/1000)); m_enchantDuration.push_back(EnchantDuration(item, slot, duration)); @@ -16703,7 +16703,7 @@ bool Player::HasQuestForItem(uint32 itemid, uint32 excludeQuestId /* 0 */, bool // allows custom amount drop when not 0 if (qinfo->ItemDropQuantity[j]) { - if ((ownedCount < qinfo->ItemDropQuantity[j]) || (turnIn && ownedCount >= qinfo->ItemDropQuantity[j])) + if (ownedCount < qinfo->ItemDropQuantity[j] || turnIn ) return true; } else if (ownedCount < pProto->GetMaxStackSize()) return true; @@ -17313,7 +17313,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder) RelocateToHomebind(); } // Player was saved in Arena or Bg - else if (mapEntry && mapEntry->IsBattlegroundOrArena()) + else if (mapEntry->IsBattlegroundOrArena()) { Battleground* currentBg = nullptr; if (m_bgData.bgInstanceID) //saved in Battleground @@ -20745,7 +20745,7 @@ Pet* Player::GetPet() const if (!pet) return nullptr; - if (IsInWorld() && pet) + if (IsInWorld()) return pet; // there may be a guardian in this slot diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index b92c004026..c1e406d353 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -1262,7 +1262,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) } } - if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size())) + if (internal_event_id >= int32(mGameEventPoolIds.size())) { TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventSpawn attempted access to out of range mGameEventGameobjectGuids element %i (size: %zu).", internal_event_id, mGameEventGameobjectGuids.size()); diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 5f6a225ec2..48fbbc6c71 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -209,7 +209,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe pet->ClearUnitState(UNIT_STATE_FOLLOW); // This is true if pet has no target or has target but targets differs. - if (pet->GetVictim() != TargetUnit || (pet->GetVictim() == TargetUnit && !pet->GetCharmInfo()->IsCommandAttack())) + if (pet->GetVictim() != TargetUnit || !pet->GetCharmInfo()->IsCommandAttack()) { if (pet->GetVictim()) pet->AttackStop(); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index ba4577cf38..b21113f0df 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -5333,7 +5333,7 @@ void Spell::EffectGameObjectDamage(SpellEffIndex /*effIndex*/) FactionTemplateEntry const* casterFaction = caster->GetFactionTemplateEntry(); FactionTemplateEntry const* targetFaction = sFactionTemplateStore.LookupEntry(gameObjTarget->GetFaction()); // Do not allow to damage GO's of friendly factions (ie: Wintergrasp Walls/Ulduar Storm Beacons) - if (!targetFaction || (casterFaction && targetFaction && !casterFaction->IsFriendlyTo(*targetFaction))) + if (!targetFaction || (casterFaction && !casterFaction->IsFriendlyTo(*targetFaction))) gameObjTarget->ModifyHealth(-damage, caster, GetSpellInfo()->Id); } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index 71487b5e04..88de9ff9d1 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -324,7 +324,7 @@ public: if (Creature* fetchVesp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VESPERON))) { - if (fetchVesp && fetchVesp->IsAlive() && !fetchVesp->GetVictim()) + if (fetchVesp->IsAlive() && !fetchVesp->GetVictim()) { _canUseWill = true; if (!fetchVesp->IsInCombat()) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index 0b6c7738cc..663df7faf2 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -224,7 +224,7 @@ public: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) { - if (target && target->IsAlive()) + if (target->IsAlive()) { DoCast(target, SPELL_HAMMER_JUSTICE); DoCast(target, SPELL_HAMMER_RIGHTEOUS); @@ -350,7 +350,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) { - if (target && target->IsAlive()) + if (target->IsAlive()) DoCast(target, SPELL_HOLY_FIRE); } if (me->HasAura(SPELL_SHIELD)) @@ -363,7 +363,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) { - if (target && target->IsAlive()) + if (target->IsAlive()) DoCast(target, SPELL_SMITE); } if (me->HasAura(SPELL_SHIELD)) @@ -456,7 +456,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { - if (target && target->IsAlive()) + if (target->IsAlive()) DoCast(target, SPELL_OLD_WOUNDS); } uiOldWoundsTimer = 12000; @@ -472,7 +472,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) { - if (target && target->IsAlive()) + if (target->IsAlive()) DoCast(target, SPELL_SHADOWS_PAST); } uiShadowPastTimer = 5000; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp index e5b749c5da..8e4400a285 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp @@ -197,7 +197,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { - if (target && target->IsAlive()) + if (target->IsAlive()) DoCast(target, SPELL_DEATH_RESPITE); } uiDeathRespiteTimer = urand(15000, 16000); @@ -225,7 +225,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { - if (target && target->IsAlive()) + if (target->IsAlive()) DoCast(target, SPELL_DESECRATION); } uiDesecration = urand(15000, 16000); @@ -252,7 +252,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { - if (target && target->IsAlive()) + if (target->IsAlive()) DoCast(target, SPELL_MARKED_DEATH); } uiMarkedDeathTimer = urand(5000, 7000); @@ -333,7 +333,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) { - if (target && target->IsAlive()) + if (target->IsAlive()) DoCast(target, (SPELL_LEAP)); } uiAttackTimer = 3500; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 49697f757a..d9f0bb4d8b 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -998,7 +998,7 @@ class npc_ball_of_flame : public CreatureScript { // need to clear states now because this call is before AuraEffect is fully removed me->ClearUnitState(UNIT_STATE_CASTING | UNIT_STATE_STUNNED); - if (target && me->Attack(target, true)) + if (me->Attack(target, true)) me->GetMotionMaster()->MoveChase(target, 1.0f); } } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index ab1a194351..3cef4f9182 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -928,7 +928,7 @@ class spell_q9874_liquid_fire : public SpellScriptLoader { Player* caster = GetCaster()->ToPlayer(); if (Creature* target = GetHitCreature()) - if (target && !target->HasAura(SPELL_FLAMES)) + if (!target->HasAura(SPELL_FLAMES)) { caster->KilledMonsterCredit(NPC_VILLAGER_KILL_CREDIT); target->CastSpell(target, SPELL_FLAMES, true);