Core/Misc: fixed more static analysis warnings

This commit is contained in:
Ovahlord
2021-03-11 19:47:07 +01:00
parent f68076a9ec
commit e59bc54a62
3 changed files with 13 additions and 26 deletions

View File

@@ -2168,7 +2168,7 @@ void Creature::LoadTemplateImmunities()
}
}
bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster, Optional<uint8> effectMask /*= nullptr*/) const
bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster, Optional<uint8> effectMask /*= {}*/) const
{
if (!spellInfo)
return false;
@@ -2179,7 +2179,7 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo, Unit* caster, Option
if (!spellInfo->Effects[i].IsEffect())
continue;
if (effectMask && !(effectMask.value() & (1 << i)))
if (effectMask && !(*effectMask & (1 << i)))
continue;
if (!IsImmunedToSpellEffect(spellInfo, i, caster))
@@ -2897,7 +2897,7 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us
if (itr == m_vendorItemCounts.end())
{
uint32 new_count = vItem->maxcount > used_count ? vItem->maxcount-used_count : 0;
m_vendorItemCounts.push_back(VendorItemCount(vItem->item, new_count));
m_vendorItemCounts.emplace_back(VendorItemCount(vItem->item, new_count));
return new_count;
}
@@ -3354,18 +3354,6 @@ bool Creature::IsEscorted() const
return false;
}
bool Creature::IsAllowedToRepostionAgainst(Unit* target) const
{
// Exceptions for repositioning against a too close enemy:
return GetCombatReach() <= 10.0f // 1. Creature has a too big combat reach
&& !IsMovementPreventedByCasting() // 2. Creature is currently casting
&& CanFreeMove() // 3. Creature cannot move
&& !GetVehicleBase() // 4. Creature is on a vehicle
&& !target->GetVehicleBase() // 5. Chase target is on a vehicle
&& !IsDungeonBoss() // 6. Creature is a dungeon boss
&& !isWorldBoss(); // 7. Creature is a world boss
}
void Creature::MakeInterruptable(bool apply)
{
ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, !apply);

View File

@@ -359,7 +359,6 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
bool IsEscorted() const;
bool CanGiveExperience() const;
bool IsAllowedToRepostionAgainst(Unit* target) const;
void MakeInterruptable(bool apply);

View File

@@ -45,20 +45,20 @@ namespace WorldPackets
struct CreatureStats
{
std::array<std::string, 4> Name;
std::array<std::string, 4> NameAlt;
std::array<std::string, 4> Name = {};
std::array<std::string, 4> NameAlt = {};
std::string Title;
std::string CursorName;
std::array<uint32, 2> Flags;
std::array<uint32, 2> Flags = {};
uint32 CreatureType = 0;
uint32 CreatureFamily = 0;
uint32 Classification = 0;
std::array<uint32, MAX_KILL_CREDIT> ProxyCreatureID;
std::array<uint32, MAX_CREATURE_MODELS> CreatureDisplayID;
std::array<uint32, MAX_KILL_CREDIT> ProxyCreatureID = {};
std::array<uint32, MAX_CREATURE_MODELS> CreatureDisplayID = {};
float HpMulti = 0.0f;
float EnergyMulti = 0.0f;
bool Leader = false;
std::array<uint32, MAX_CREATURE_QUEST_ITEMS> QuestItems;
std::array<uint32, MAX_CREATURE_QUEST_ITEMS> QuestItems = {};
uint32 CreatureMovementInfoID = 0;
uint32 RequiredExpansion = 0;
};
@@ -88,15 +88,15 @@ namespace WorldPackets
struct GameObjectStats
{
std::array<std::string, 4> Name;
std::array<std::string, 4> Name = {};
std::string IconName;
std::string CastBarCaption;
std::string UnkString;
uint32 Type = 0;
uint32 DisplayID = 0;
std::array<uint32, MAX_GAMEOBJECT_DATA> Data;
std::array<uint32, MAX_GAMEOBJECT_DATA> Data = {};
float Size = 0.0f;
std::array<uint32, MAX_GAMEOBJECT_QUEST_ITEMS> QuestItems;
std::array<uint32, MAX_GAMEOBJECT_QUEST_ITEMS> QuestItems = {};
int32 RequiredLevel = 0;
};
@@ -120,7 +120,7 @@ namespace WorldPackets
void Read() override;
uint32 MissingQuestCount = 0;
std::array<uint32, MAX_QUEST_LOG_SIZE> MissingQuestPOIs;
std::array<uint32, MAX_QUEST_LOG_SIZE> MissingQuestPOIs = {};
};
struct DBQueryRecord