fix(Core/Misc): all GCC warnings (#3457)

This commit is contained in:
Francesco Borzì
2020-09-14 17:31:12 +02:00
committed by GitHub
parent 80b149b218
commit b61ae8abcd
34 changed files with 157 additions and 75 deletions

View File

@@ -483,6 +483,7 @@ void GameObject::Update(uint32 diff)
}
// NO BREAK for switch (m_lootState)
[[fallthrough]];
}
case GO_READY:
{

View File

@@ -401,10 +401,10 @@ struct Position
Position* m_pos;
};
float m_positionX;
float m_positionY;
float m_positionZ;
float m_orientation;
float m_positionX = 0;
float m_positionY = 0;
float m_positionZ = 0;
float m_orientation = 0;
bool operator==(Position const &a);

View File

@@ -10023,7 +10023,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
bf->FillInitialWorldStates(data);
break;
}
// No break here, intended.
[[fallthrough]];
default:
data << uint32(0x914) << uint32(0x0); // 7
data << uint32(0x913) << uint32(0x0); // 8
@@ -15823,14 +15823,14 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RequiredItemId[i]))
if (sObjectMgr->GetItemTemplate(quest->RequiredItemId[i]))
{
DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true);
}
}
for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
{
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->ItemDrop[i]))
if (sObjectMgr->GetItemTemplate(quest->ItemDrop[i]))
{
DestroyItemCount(quest->ItemDrop[i], quest->ItemDropQuantity[i], true);
}
@@ -18968,7 +18968,6 @@ void Player::_LoadMailAsynch(PreparedQueryResult result)
{
do
{
bool has_items = false;
Field* fields = result->Fetch();
if (fields[14].GetUInt32() != prevMailID)
{
@@ -18983,7 +18982,7 @@ void Player::_LoadMailAsynch(PreparedQueryResult result)
m->receiver = fields[17].GetUInt32();
m->subject = fields[18].GetString();
m->body = fields[19].GetString();
has_items = fields[20].GetBool();
// has_items = fields[20].GetBool();
m->expire_time = time_t(fields[21].GetUInt32());
m->deliver_time = time_t(fields[22].GetUInt32());
m->money = fields[23].GetUInt32();

View File

@@ -2912,13 +2912,15 @@ SpellMissInfo Unit::SpellHitResult(Unit* victim, SpellInfo const* spell, bool Ca
case SPELL_DAMAGE_CLASS_NONE:
{
if (spell->SpellFamilyName)
{
return SPELL_MISS_NONE;
}
// Xinef: apply DAMAGE_CLASS_MAGIC conditions to damaging DAMAGE_CLASS_NONE spells
for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
if (spell->Effects[i].Effect && spell->Effects[i].Effect != SPELL_EFFECT_SCHOOL_DAMAGE)
if (spell->Effects[i].ApplyAuraName != SPELL_AURA_PERIODIC_DAMAGE)
return SPELL_MISS_NONE;
// no break intended
[[fallthrough]];
}
case SPELL_DAMAGE_CLASS_MAGIC:
return MagicSpellHitResult(victim, spell);
@@ -6812,6 +6814,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
triggered_spell_id = isWrathSpell ? 48518 : 48517;
break;
}
[[fallthrough]]; // TODO: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
}
case SPELLFAMILY_ROGUE:
{
@@ -8593,6 +8596,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
target = this;
trigger_spell_id = 22588;
[[fallthrough]]; // TODO: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
}
// Bonus Healing (Crystal Spire of Karabor mace)
case 40971:
@@ -11088,9 +11092,9 @@ float Unit::SpellTakenCritChance(Unit const* caster, SpellInfo const* spellProto
switch ((*i)->GetMiscValue())
{
// Shatter
case 911: modChance+= 16;
case 910: modChance+= 17;
case 849: modChance+= 17;
case 911: modChance+= 16; [[fallthrough]];
case 910: modChance+= 17; [[fallthrough]];
case 849: modChance+= 17;
if (!HasAuraState(AURA_STATE_FROZEN, spellProto, caster))
break;
crit_chance+=modChance;
@@ -11199,6 +11203,7 @@ float Unit::SpellTakenCritChance(Unit const* caster, SpellInfo const* spellProto
}
break;
}
[[fallthrough]]; // TODO: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
case SPELL_DAMAGE_CLASS_RANGED:
{
// flat aura mods