diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index a52d45ac06..31967f484b 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -162,7 +162,7 @@ void FollowerAI::UpdateFollowerAI(uint32 /*uiDiff*/) void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, uint32 quest) { - if (Map* map = me->GetMap()) + if (me->GetMap()) { if (CreatureData const* cdata = me->GetCreatureData()) { diff --git a/src/server/game/Battlegrounds/Arena.cpp b/src/server/game/Battlegrounds/Arena.cpp index 463b8874b6..375cadffb5 100644 --- a/src/server/game/Battlegrounds/Arena.cpp +++ b/src/server/game/Battlegrounds/Arena.cpp @@ -225,17 +225,17 @@ void Arena::EndBattleground(uint32 winner) // In case of arena draw, follow this logic: // winnerArenaTeam => ALLIANCE, loserArenaTeam => HORDE - ArenaTeam* winnerArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(winner == 0 ? ALLIANCE : winner)); - ArenaTeam* loserArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(winner == 0 ? HORDE : GetOtherTeam(winner))); + ArenaTeam* winnerArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(winner == 0 ? AsUnderlyingType(ALLIANCE) : winner)); + ArenaTeam* loserArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(winner == 0 ? AsUnderlyingType(HORDE) : GetOtherTeam(winner))); if (winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam) { // In case of arena draw, follow this logic: // winnerMatchmakerRating => ALLIANCE, loserMatchmakerRating => HORDE loserTeamRating = loserArenaTeam->GetRating(); - loserMatchmakerRating = GetArenaMatchmakerRating(winner == 0 ? HORDE : GetOtherTeam(winner)); + loserMatchmakerRating = GetArenaMatchmakerRating(winner == 0 ? AsUnderlyingType(HORDE) : GetOtherTeam(winner)); winnerTeamRating = winnerArenaTeam->GetRating(); - winnerMatchmakerRating = GetArenaMatchmakerRating(winner == 0 ? ALLIANCE : winner); + winnerMatchmakerRating = GetArenaMatchmakerRating(winner == 0 ? AsUnderlyingType(ALLIANCE) : winner); if (winner != 0) { @@ -251,8 +251,8 @@ void Arena::EndBattleground(uint32 winner) // bg team that the client expects is different to TeamId // alliance 1, horde 0 - uint8 winnerTeam = winner == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE; - uint8 loserTeam = winner == ALLIANCE ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE; + uint8 winnerTeam = winner == uint32(ALLIANCE) ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE; + uint8 loserTeam = winner == uint32(ALLIANCE) ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE; _arenaTeamScores[winnerTeam].Assign(winnerChange, winnerMatchmakerRating, winnerArenaTeam->GetName()); _arenaTeamScores[loserTeam].Assign(loserChange, loserMatchmakerRating, loserArenaTeam->GetName()); diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index d148bd30a9..9181388dda 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -997,7 +997,7 @@ void GameObject::Update(uint32 diff) Unit* target = nullptr; /// @todo this hack with search required until GO casting not implemented - if (Unit* owner = GetOwner()) + if (GetOwner()) { // Hunter trap: Search units which are unfriendly to the trap's owner Trinity::NearestAttackableNoTotemUnitInObjectRangeCheck checker(this, radius); diff --git a/src/server/game/Skills/Archaeology/Archaeology.cpp b/src/server/game/Skills/Archaeology/Archaeology.cpp index 7b71245af0..5c5408e810 100644 --- a/src/server/game/Skills/Archaeology/Archaeology.cpp +++ b/src/server/game/Skills/Archaeology/Archaeology.cpp @@ -21,8 +21,6 @@ Archaeology::Archaeology(Player* player): _player(player) { - memset(_site, 0, sizeof(SiteData) * CONTINENT_SITES * COUNT_CONT); - _continentState[CONT_EASTERN] = STATE_NULL; _continentState[CONT_KALIMDOR] = STATE_NULL; _continentState[CONT_OUTLAND] = STATE_NULL; diff --git a/src/server/game/Skills/Archaeology/Archaeology.h b/src/server/game/Skills/Archaeology/Archaeology.h index 2d88b27437..fc68da7cae 100644 --- a/src/server/game/Skills/Archaeology/Archaeology.h +++ b/src/server/game/Skills/Archaeology/Archaeology.h @@ -68,7 +68,7 @@ class Archaeology // Site Functionality ContinentState _continentState[CONTINENT_SITES]; - SiteData _site[CONTINENT_SITES * COUNT_CONT]; + std::array _site; void LoadSitesFromDB(); void VerifySites(); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 34abe9bf1d..57ad1e6eb8 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -4924,7 +4924,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) QuaternionData rot = QuaternionData::fromEulerAnglesZYX(fo, 0.f, 0.f); GameObject* go = new GameObject; - if (!go->Create(cMap->GenerateLowGuid(), name_id, cMap, Position(fx, fy, fz, m_caster->GetOrientation()), rot, 255, GO_STATE_READY)) + if (!go->Create(cMap->GenerateLowGuid(), name_id, cMap, pos, rot, 255, GO_STATE_READY)) { delete go; return; diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index f10c3c012a..9589a5a809 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -557,53 +557,49 @@ public: for (auto const& questTemplatePair : questTemplates) { uint8 localeIndex = handler->GetSessionDbLocaleIndex(); - if (localeIndex >= 0) + if (QuestLocale const* questLocale = sObjectMgr->GetQuestLocale(questTemplatePair.first)) { - uint8 ulocaleIndex = uint8(localeIndex); - if (QuestLocale const* questLocale = sObjectMgr->GetQuestLocale(questTemplatePair.first)) + if (questLocale->Title.size() > localeIndex && !questLocale->Title[localeIndex].empty()) { - if (questLocale->Title.size() > ulocaleIndex && !questLocale->Title[ulocaleIndex].empty()) + std::string const& title = questLocale->Title[localeIndex]; + + if (Utf8FitTo(title, wNamePart)) { - std::string const& title = questLocale->Title[ulocaleIndex]; - - if (Utf8FitTo(title, wNamePart)) + if (maxResults && count++ == maxResults) { - if (maxResults && count++ == maxResults) - { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - char const* statusStr = ""; - - if (target) - { - switch (target->GetQuestStatus(questTemplatePair.first)) - { - case QUEST_STATUS_COMPLETE: - statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); - break; - case QUEST_STATUS_INCOMPLETE: - statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); - break; - case QUEST_STATUS_REWARDED: - statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_REWARDED); - break; - default: - break; - } - } - - if (handler->GetSession()) - handler->PSendSysMessage(LANG_QUEST_LIST_CHAT, questTemplatePair.first, questTemplatePair.first, questTemplatePair.second.GetQuestLevel(), title.c_str(), statusStr); - else - handler->PSendSysMessage(LANG_QUEST_LIST_CONSOLE, questTemplatePair.first, title.c_str(), statusStr); - - if (!found) - found = true; - - continue; + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; } + + char const* statusStr = ""; + + if (target) + { + switch (target->GetQuestStatus(questTemplatePair.first)) + { + case QUEST_STATUS_COMPLETE: + statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); + break; + case QUEST_STATUS_INCOMPLETE: + statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); + break; + case QUEST_STATUS_REWARDED: + statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_REWARDED); + break; + default: + break; + } + } + + if (handler->GetSession()) + handler->PSendSysMessage(LANG_QUEST_LIST_CHAT, questTemplatePair.first, questTemplatePair.first, questTemplatePair.second.GetQuestLevel(), title.c_str(), statusStr); + else + handler->PSendSysMessage(LANG_QUEST_LIST_CONSOLE, questTemplatePair.first, title.c_str(), statusStr); + + if (!found) + found = true; + + continue; } } } diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index cf68c1ed5b..8553873977 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -353,9 +353,7 @@ public: _preparingPulsesChecker = 0; _arcaneOverloadGUID.Clear(); _lastHitByArcaneBarrageGUID.Clear(); - for (ObjectGuid& guid : _surgeTargetGUID) - guid.Clear(); - + _surgeTargetGUID.fill(ObjectGuid::Empty); _killSpamFilter = false; _executingVortex = false; _arcaneReinforcements = true; @@ -949,7 +947,7 @@ public: } else if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) { - memset(_surgeTargetGUID, 0, sizeof(_surgeTargetGUID)); + _surgeTargetGUID.fill(ObjectGuid::Empty); DoCastAOE(SPELL_SURGE_OF_POWER_WARNING_SELECTOR_25, true); } @@ -993,7 +991,7 @@ public: uint8 _preparingPulsesChecker; // In retail they use 2 preparing pulses with 7 sec CD, after they pass 2 seconds. ObjectGuid _arcaneOverloadGUID; // Last Arcane Overload summoned to know to which should visual be cast to (the purple ball, not bubble). ObjectGuid _lastHitByArcaneBarrageGUID; // Last hit player by Arcane Barrage, will be removed if targets > 1. - ObjectGuid _surgeTargetGUID[3]; // All these three are used to keep current tagets to which warning should be sent. + std::array _surgeTargetGUID; // All these three are used to keep current tagets to which warning should be sent. bool _killSpamFilter; // Prevent text spamming on killed player by helping implement a CD. bool _despawned; // Checks if boss pass through evade on reset. diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index c0fc474623..f02299b6da 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -217,7 +217,7 @@ public: IsFinalForm = false; NeedThreatReset = false; EnrageUsed = false; - memset(InnderDemon, 0, sizeof(InnderDemon)); + InnderDemon.fill(ObjectGuid::Empty); InnerDemon_Count = 0; } @@ -238,7 +238,7 @@ public: bool EnrageUsed; float x, y, z; - ObjectGuid InnderDemon[5]; + std::array InnderDemon; uint32 InnerDemon_Count; ObjectGuid Demon; ObjectGuid SpellBinderGUID[3]; diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index bfa79b7f8f..5e103e8f08 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -703,7 +703,7 @@ class spell_dk_pestilence : public SpellScript float donePct = aurOld->GetDonePct(); float critChance = aurOld->GetCritChance(); - if (AuraEffect* aurEffOld = aurOld->GetEffect(EFFECT_0)) + if (aurOld->GetEffect(EFFECT_0)) { caster->CastSpell(hitUnit, SPELL_DK_BLOOD_PLAGUE, true); // Spread the disease to hitUnit.