Core/Misc: Fix static analysis issues

This commit is contained in:
Aokromes committed 2017-12-09 00:00:27 +01:00
1 parent 21cad46097
commit 5efa54d11c
12 files changed
+27 -27

No files matched your search

@@ -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;
+1 -1
View File
@@ -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);
}
@@ -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);
+9 -9
View File
@@ -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
+1 -1
View File
@@ -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());
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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);
}
@@ -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())
@@ -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;
@@ -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;
@@ -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);
}
}
+1 -1
View File
@@ -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);