Core/Misc: Warning fixes (/W4) (#23149)

* Core/Misc: Warning fixes (/W4)
This commit is contained in:
Gustavo
2019-04-03 23:36:26 -03:00
committed by GitHub
parent 70a88e2195
commit 50f122de77
5 changed files with 33 additions and 25 deletions

View File

@@ -962,8 +962,8 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
if (!dungeons.empty())
{
uint32 rDungeonId = (*dungeons.begin());
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(rDungeonId);
if (dungeon && dungeon->type == LFG_TYPE_RANDOM)
LFGDungeonEntry const* dungeonEntry = sLFGDungeonStore.LookupEntry(rDungeonId);
if (dungeonEntry && dungeonEntry->type == LFG_TYPE_RANDOM)
player->CastSpell(player, LFG_SPELL_DUNGEON_COOLDOWN, false);
}
}

View File

@@ -529,7 +529,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
if (controlled->GetEntry() == pet->GetEntry() && controlled->IsAlive())
pets.push_back(controlled);
for (Unit* pet : pets)
for (Unit* petControlled : pets)
{
// check swap (at command->spell swap client remove spell first in another packet, so check only command move correctness)
if (move_command)
@@ -564,28 +564,28 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
_player->GetName().c_str(), position[i], spell_id, uint32(act_state));
//if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add
if (!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !pet->HasSpell(spell_id)))
if (!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !petControlled->HasSpell(spell_id)))
{
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id))
{
//sign for autocast
if (act_state == ACT_ENABLED)
{
if (pet->GetTypeId() == TYPEID_UNIT && pet->IsPet())
((Pet*)pet)->ToggleAutocast(spellInfo, true);
if (petControlled->GetTypeId() == TYPEID_UNIT && petControlled->IsPet())
((Pet*)petControlled)->ToggleAutocast(spellInfo, true);
else
for (Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
if ((*itr)->GetEntry() == pet->GetEntry())
if ((*itr)->GetEntry() == petControlled->GetEntry())
(*itr)->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, true);
}
//sign for no/turn off autocast
else if (act_state == ACT_DISABLED)
{
if (pet->GetTypeId() == TYPEID_UNIT && pet->IsPet())
((Pet*)pet)->ToggleAutocast(spellInfo, false);
if (petControlled->GetTypeId() == TYPEID_UNIT && petControlled->IsPet())
((Pet*)petControlled)->ToggleAutocast(spellInfo, false);
else
for (Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
if ((*itr)->GetEntry() == pet->GetEntry())
if ((*itr)->GetEntry() == petControlled->GetEntry())
(*itr)->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, false);
}
}
@@ -740,23 +740,23 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
if (controlled->GetEntry() == pet->GetEntry() && controlled->IsAlive())
pets.push_back(controlled);
for (Unit* pet : pets)
for (Unit* petControlled : pets)
{
// do not add not learned spells/ passive spells
if (!pet->HasSpell(spellid) || !spellInfo->IsAutocastable())
if (!petControlled->HasSpell(spellid) || !spellInfo->IsAutocastable())
return;
CharmInfo* charmInfo = pet->GetCharmInfo();
CharmInfo* charmInfo = petControlled->GetCharmInfo();
if (!charmInfo)
{
TC_LOG_ERROR("entities.pet", "WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUID().GetCounter(), pet->GetTypeId());
TC_LOG_ERROR("entities.pet", "WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", petControlled->GetGUID().GetCounter(), petControlled->GetTypeId());
return;
}
if (pet->IsPet())
((Pet*)pet)->ToggleAutocast(spellInfo, state != 0);
if (petControlled->IsPet())
((Pet*)petControlled)->ToggleAutocast(spellInfo, state != 0);
else
pet->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, state != 0);
petControlled->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, state != 0);
charmInfo->SetSpellAutocast(spellInfo, state != 0);
}

View File

@@ -7456,12 +7456,12 @@ void Spell::HandleLaunchPhase()
if (usesAmmo && !ammoTaken)
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
if (!(mask & 1 << i))
if (!(mask & 1 << j))
continue;
switch (m_spellInfo->Effects[i].Effect)
switch (m_spellInfo->Effects[j].Effect)
{
case SPELL_EFFECT_SCHOOL_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE:

View File

@@ -526,7 +526,15 @@ public:
uint32 accountId;
if (accountName)
{
if (!Utf8ToUpperOnlyLatin(*accountName) || !(accountId = AccountMgr::GetId(*accountName)))
if (!Utf8ToUpperOnlyLatin(*accountName))
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName->c_str());
handler->SetSentErrorMessage(true);
return false;
}
accountId = AccountMgr::GetId(*accountName);
if (!accountId)
{
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName->c_str());
handler->SetSentErrorMessage(true);

View File

@@ -311,11 +311,11 @@ class spell_pal_avenging_wrath : public SpellScriptLoader
void HandleApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (AuraEffect const* aurEff = target->GetAuraEffectOfRankedSpell(SPELL_PALADIN_SANCTIFIED_WRATH_TALENT_R1, EFFECT_2))
if (AuraEffect const* sanctifiedWrathAurEff = target->GetAuraEffectOfRankedSpell(SPELL_PALADIN_SANCTIFIED_WRATH_TALENT_R1, EFFECT_2))
{
CastSpellExtraArgs args(aurEff);
args.AddSpellMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount())
.AddSpellMod(SPELLVALUE_BASE_POINT1, aurEff->GetAmount());
CastSpellExtraArgs args(sanctifiedWrathAurEff);
args.AddSpellMod(SPELLVALUE_BASE_POINT0, sanctifiedWrathAurEff->GetAmount())
.AddSpellMod(SPELLVALUE_BASE_POINT1, sanctifiedWrathAurEff->GetAmount());
target->CastSpell(target, SPELL_PALADIN_SANCTIFIED_WRATH, args);
}