aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2021-06-20 13:11:53 +0200
committerjackpoz <giacomopoz@gmail.com>2021-06-20 13:11:53 +0200
commit33dace231c5a169375523ffa89a2cc3fa48737bd (patch)
treee8023841a9c396371bcd636c67805f3920be354a /src/server/scripts
parent5446209b89146fdbe01627e806f7beddd6ae5de8 (diff)
Core/Misc: Fix issues reported by static analysis
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp8
-rw-r--r--src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp2
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp4
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp2
-rw-r--r--src/server/scripts/World/achievement_scripts.cpp2
5 files changed, 7 insertions, 11 deletions
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index d0c2f87f3fd..a232da2ef1b 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -197,9 +197,7 @@ public:
sObjectMgr->AddVendorItem(vendor_entry, itemId, maxcount, incrtime, extendedcost);
- ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
-
- handler->PSendSysMessage(LANG_ITEM_ADDED_TO_LIST, itemId, itemTemplate->Name1.c_str(), maxcount, incrtime, extendedcost);
+ handler->PSendSysMessage(LANG_ITEM_ADDED_TO_LIST, itemId, item->Name1.c_str(), maxcount, incrtime, extendedcost);
return true;
}
@@ -351,9 +349,7 @@ public:
return false;
}
- ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
-
- handler->PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST, itemId, itemTemplate->Name1.c_str());
+ handler->PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST, itemId, item->Name1.c_str());
return true;
}
diff --git a/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp b/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp
index 6e7a5d17b2e..dca25b593ae 100644
--- a/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp
+++ b/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp
@@ -204,7 +204,7 @@ class spell_ioc_launch : public SpellScript
if (!GetCaster()->ToCreature() || !GetExplTargetDest())
return;
- GetCaster()->ToCreature()->m_Events.AddEvent(new StartLaunchEvent(*GetExplTargetDest(), GetHitPlayer()->GetGUID().GetCounter()), GetCaster()->ToCreature()->m_Events.CalculateTime(2500ms));
+ GetCaster()->ToCreature()->m_Events.AddEvent(new StartLaunchEvent(*GetExplTargetDest(), ASSERT_NOTNULL(GetHitPlayer())->GetGUID().GetCounter()), GetCaster()->ToCreature()->m_Events.CalculateTime(2500ms));
}
void Register() override
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp
index 5c39a3c9e04..f245bd6e873 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp
@@ -113,7 +113,7 @@ private:
struct npc_underbog_mushroom : public ScriptedAI
{
- npc_underbog_mushroom(Creature* creature) : ScriptedAI(creature) { }
+ npc_underbog_mushroom(Creature* creature) : ScriptedAI(creature), _counter(0) { }
void InitializeAI() override
{
@@ -154,7 +154,7 @@ struct npc_underbog_mushroom : public ScriptedAI
private:
TaskScheduler _scheduler;
- uint32 _counter = 0;
+ uint32 _counter;
};
void AddSC_boss_hungarfen()
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index 767042a04b0..1aeb8cd1445 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -2019,7 +2019,7 @@ class spell_dk_raise_dead : public SpellScriptLoader
SpellCastResult CheckReagents()
{
/// @workaround: there is no access to castresult of other spells, check it manually
- SpellInfo const* reagentSpell = sSpellMgr->GetSpellInfo(SPELL_DK_RAISE_DEAD_USE_REAGENT);
+ SpellInfo const* reagentSpell = sSpellMgr->AssertSpellInfo(SPELL_DK_RAISE_DEAD_USE_REAGENT);
Player* player = GetCaster()->ToPlayer();
if (!player->CanNoReagentCast(reagentSpell))
{
diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp
index 3c075e8fc6b..125d7f9d088 100644
--- a/src/server/scripts/World/achievement_scripts.cpp
+++ b/src/server/scripts/World/achievement_scripts.cpp
@@ -143,7 +143,7 @@ class achievement_arena_kills : public AchievementCriteriaScript
if (!source->InArena())
return false;
- return source->GetBattleground()->GetArenaType() == _arenaType;
+ return ASSERT_NOTNULL(source->GetBattleground())->GetArenaType() == _arenaType;
}
private: