diff options
| author | ariel- <ariel-@users.noreply.github.com> | 2018-01-22 23:55:33 -0300 |
|---|---|---|
| committer | ariel- <ariel-@users.noreply.github.com> | 2018-01-22 23:55:33 -0300 |
| commit | c099174ff777d1bf5061f5cdc197ff17bd83fbb7 (patch) | |
| tree | c48689319a23398682db06558e3633759d79614f /src/server/scripts | |
| parent | 7c9722a4ae08b5f283f6a085a411e37604a7da9f (diff) | |
Core/Misc: fix some /W4 warnings and some reported by GCC 6.3
Diffstat (limited to 'src/server/scripts')
| -rw-r--r-- | src/server/scripts/Commands/cs_lookup.cpp | 104 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp | 23 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 4 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_warlock.cpp | 7 |
4 files changed, 64 insertions, 74 deletions
diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 2accfc462d2..8fade3ec857 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -416,33 +416,29 @@ public: for (auto const& itemTemplatePair : its) { uint8 localeIndex = handler->GetSessionDbLocaleIndex(); - if (localeIndex >= 0) + if (ItemLocale const* il = sObjectMgr->GetItemLocale(itemTemplatePair.first)) { - uint8 ulocaleIndex = uint8(localeIndex); - if (ItemLocale const* il = sObjectMgr->GetItemLocale(itemTemplatePair.first)) + if (il->Name.size() > localeIndex && !il->Name[localeIndex].empty()) { - if (il->Name.size() > ulocaleIndex && !il->Name[ulocaleIndex].empty()) - { - std::string const& name = il->Name[ulocaleIndex]; + std::string const& name = il->Name[localeIndex]; - if (Utf8FitTo(name, wNamePart)) + if (Utf8FitTo(name, wNamePart)) + { + if (maxResults && count++ == maxResults) { - if (maxResults && count++ == maxResults) - { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } - if (handler->GetSession()) - handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itemTemplatePair.first, itemTemplatePair.first, name.c_str()); - else - handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itemTemplatePair.first, name.c_str()); + if (handler->GetSession()) + handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itemTemplatePair.first, itemTemplatePair.first, name.c_str()); + else + handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itemTemplatePair.first, name.c_str()); - if (!found) - found = true; + if (!found) + found = true; - continue; - } + continue; } } } @@ -647,53 +643,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[ulocaleIndex]; + std::string const& title = questLocale->Title[localeIndex]; - if (Utf8FitTo(title, wNamePart)) + if (Utf8FitTo(title, wNamePart)) + { + if (maxResults && count++ == maxResults) { - if (maxResults && count++ == maxResults) - { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } - char const* statusStr = ""; + char const* statusStr = ""; - if (target) + if (target) + { + switch (target->GetQuestStatus(questTemplatePair.first)) { - 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; - } + 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 (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; + if (!found) + found = true; - continue; - } + continue; } } } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp index d4cad450d83..79a8f44b475 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp @@ -567,7 +567,7 @@ class spell_auriaya_agro_creator : public SpellScript } }; -// 61906 - Random Aggro Periodic (5 sec) +// 61906 - Random Aggro Periodic (5 sec) class spell_auriaya_random_agro_periodic : public AuraScript { PrepareAuraScript(spell_auriaya_random_agro_periodic); @@ -583,17 +583,16 @@ class spell_auriaya_random_agro_periodic : public AuraScript if (!owner || !owner->IsAIEnabled || owner->HasReactState(REACT_PASSIVE)) return; - if (Unit* target = owner->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, CatsTargetSelector(owner, 15.0f, 25.0f))) - { - owner->GetThreatManager().AddThreat(target, 3000000.0f, nullptr, true); - owner->CastSpell(target, SPELL_FERAL_POUNCE, true); - owner->AI()->AttackStart(target); - } - else if (Unit* target = owner->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - owner->GetThreatManager().AddThreat(target, 3000000.0f); - owner->AI()->AttackStart(target); - } + Unit* target = owner->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, CatsTargetSelector(owner, 15.0f, 25.0f)); + if (!target) + target = owner->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0); + + if (!target) + return; + + owner->GetThreatManager().AddThreat(target, 3000000.0f, nullptr, true); + owner->CastSpell(target, SPELL_FERAL_POUNCE, true); + owner->AI()->AttackStart(target); } void Register() override diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 8729fb4c889..238637a13f2 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -1736,7 +1736,7 @@ class spell_dk_pestilence : public SpellScriptLoader 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. @@ -1754,7 +1754,7 @@ class spell_dk_pestilence : public SpellScriptLoader { float donePct = aurOld->GetDonePct(); - if (AuraEffect* aurEffOld = aurOld->GetEffect(EFFECT_0)) + if (aurOld->GetEffect(EFFECT_0)) { caster->CastSpell(hitUnit, SPELL_DK_FROST_FEVER, true); // Spread the disease to hitUnit. diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 4f5aa72c759..279553f87e9 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -830,7 +830,6 @@ class spell_warl_life_tap : public SpellScriptLoader if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, WARLOCK_ICON_ID_IMPROVED_LIFE_TAP, 0)) AddPct(mana, aurEff->GetAmount()); - // @todo castspell refactor note: this is not triggered - intended? CastSpellExtraArgs args; args.AddSpellBP0(mana); caster->CastSpell(target, SPELL_WARLOCK_LIFE_TAP_ENERGIZE, args); @@ -843,9 +842,9 @@ class spell_warl_life_tap : public SpellScriptLoader if (manaFeedVal > 0) { ApplyPct(manaFeedVal, mana); - CastSpellExtraArgs args(TRIGGERED_FULL_MASK); - args.AddSpellBP0(manaFeedVal); - caster->CastSpell(caster, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2, args); + CastSpellExtraArgs manaFeedArgs(TRIGGERED_FULL_MASK); + manaFeedArgs.AddSpellBP0(manaFeedVal); + caster->CastSpell(caster, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2, manaFeedArgs); } } } |
