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

* Core/Misc: Warning fixes (/W4)

(cherry picked from commit 50f122de77)
This commit is contained in:
Gustavo
2019-04-03 23:36:26 -03:00
committed by Shauren
parent 5aa0539d4b
commit 6aaf9aaf3b
3 changed files with 17 additions and 9 deletions

View File

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

View File

@@ -643,21 +643,21 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPackets::Pet::PetSpellAutoc
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(packet.SpellID) || !spellInfo->IsAutocastable())
if (!petControlled->HasSpell(packet.SpellID) || !spellInfo->IsAutocastable())
return;
CharmInfo* charmInfo = pet->GetCharmInfo();
CharmInfo* charmInfo = petControlled->GetCharmInfo();
if (!charmInfo)
{
TC_LOG_ERROR("entities.pet", "WorldSession::HandlePetSpellAutocastOpcode: object (%s) is considered pet-like but doesn't have a charminfo!", pet->GetGUID().ToString().c_str());
TC_LOG_ERROR("entities.pet", "WorldSession::HandlePetSpellAutocastOpcode: object (%s) is considered pet-like but doesn't have a charminfo!", petControlled->GetGUID().ToString().c_str());
return;
}
if (pet->IsPet())
pet->ToPet()->ToggleAutocast(spellInfo, packet.AutocastEnabled);
if (petControlled->IsPet())
petControlled->ToPet()->ToggleAutocast(spellInfo, packet.AutocastEnabled);
else
charmInfo->ToggleCreatureAutocast(spellInfo, packet.AutocastEnabled);

View File

@@ -524,7 +524,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);