aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/SmartScripts
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2020-08-04 09:36:47 +0000
committerShauren <shauren.trinity@gmail.com>2022-01-26 14:06:40 +0100
commit864d775280097f9b6440e4fef1d3800b48b254ae (patch)
tree9cd881a957dc715819a8a530a42777d45000892a /src/server/game/AI/SmartScripts
parentafcb13cd44cf77d6599805f7160d9255c0a6ca4c (diff)
Core/Misc: Fix static analysis issues (#25194)
(cherry picked from commit 07fd84b679fd6958b7e669a96c78783875e1b949)
Diffstat (limited to 'src/server/game/AI/SmartScripts')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp13
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.h6
2 files changed, 8 insertions, 11 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index d99cb1353e9..dade4e32d60 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -67,9 +67,7 @@ SmartScript::~SmartScript()
{
}
-// @todo this is an utter clusterfuck in terms of design - why in the world does this thing side effect?
-// seriously, WHO WRITES THIS SHIT
-bool SmartScript::IsSmart(Creature* c, bool silent)
+bool SmartScript::IsSmart(Creature* c, bool silent) const
{
if (!c)
return false;
@@ -79,13 +77,12 @@ bool SmartScript::IsSmart(Creature* c, bool silent)
smart = false;
if (!smart && !silent)
- TC_LOG_ERROR("sql.sql", "SmartScript: Action target Creature (GUID: " UI64FMTD " Entry: %u) is not using SmartAI, action called by Creature (GUID: " UI64FMTD " Entry: %u) skipped to prevent crash.", uint64(c ? c->GetSpawnId() : UI64LIT(0)), c ? c->GetEntry() : 0, uint64(me ? me->GetSpawnId() : UI64LIT(0)), me ? me->GetEntry() : 0);
+ TC_LOG_ERROR("sql.sql", "SmartScript: Action target Creature (GUID: " UI64FMTD " Entry: %u) is not using SmartAI, action called by Creature (GUID: " UI64FMTD " Entry: %u) skipped to prevent crash.", c->GetSpawnId(), c->GetEntry(), uint64(me ? me->GetSpawnId() : UI64LIT(0)), me ? me->GetEntry() : 0);
return smart;
}
-// @todo this, too
-bool SmartScript::IsSmart(GameObject* g, bool silent)
+bool SmartScript::IsSmart(GameObject* g, bool silent) const
{
if (!g)
return false;
@@ -95,12 +92,12 @@ bool SmartScript::IsSmart(GameObject* g, bool silent)
smart = false;
if (!smart && !silent)
- TC_LOG_ERROR("sql.sql", "SmartScript: Action target GameObject (GUID: " UI64FMTD " Entry: %u) is not using SmartGameObjectAI, action called by GameObject (GUID: " UI64FMTD " Entry: %u) skipped to prevent crash.", uint64(g ? g->GetSpawnId() : UI64LIT(0)), g ? g->GetEntry() : 0, uint64(go ? go->GetSpawnId() : UI64LIT(0)), go ? go->GetEntry() : 0);
+ TC_LOG_ERROR("sql.sql", "SmartScript: Action target GameObject (GUID: " UI64FMTD " Entry: %u) is not using SmartGameObjectAI, action called by GameObject (GUID: " UI64FMTD " Entry: %u) skipped to prevent crash.", g->GetSpawnId(), g->GetEntry(), uint64(go ? go->GetSpawnId() : UI64LIT(0)), go ? go->GetEntry() : 0);
return smart;
}
-bool SmartScript::IsSmart(bool silent)
+bool SmartScript::IsSmart(bool silent) const
{
if (me)
return IsSmart(me, silent);
diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h
index 55061ab40ef..4dd0faf5522 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.h
+++ b/src/server/game/AI/SmartScripts/SmartScript.h
@@ -74,9 +74,9 @@ class TC_GAME_API SmartScript
void DoFindFriendlyMissingBuff(std::vector<Creature*>& creatures, float range, uint32 spellid) const;
Unit* DoFindClosestFriendlyInRange(float range, bool playerOnly) const;
- bool IsSmart(Creature* c, bool silent = false);
- bool IsSmart(GameObject* g, bool silent = false);
- bool IsSmart(bool silent = false);
+ bool IsSmart(Creature* c, bool silent = false) const;
+ bool IsSmart(GameObject* g, bool silent = false) const;
+ bool IsSmart(bool silent = false) const;
void StoreTargetList(ObjectVector const& targets, uint32 id);
void AddToStoredTargetList(ObjectVector const& targets, uint32 id);