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
committerGitHub <noreply@github.com>2020-08-04 11:36:47 +0200
commit07fd84b679fd6958b7e669a96c78783875e1b949 (patch)
tree898e098e9985a08ca84cc9077b132279f43df945 /src/server/game/AI/SmartScripts
parentbc6137d08c08ef2fb29e871cf5659c4d1c5c41ab (diff)
Core/Misc: Fix static analysis issues (#25194)
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 4bf828aef11..e7c7d337b1d 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -63,9 +63,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;
@@ -75,13 +73,12 @@ bool SmartScript::IsSmart(Creature* c, bool silent)
smart = false;
if (!smart && !silent)
- TC_LOG_ERROR("sql.sql", "SmartScript: Action target Creature (GUID: %u Entry: %u) is not using SmartAI, action called by Creature (GUID: %u Entry: %u) skipped to prevent crash.", c ? c->GetSpawnId() : 0, c ? c->GetEntry() : 0, me ? me->GetSpawnId() : 0, me ? me->GetEntry() : 0);
+ TC_LOG_ERROR("sql.sql", "SmartScript: Action target Creature (GUID: %u Entry: %u) is not using SmartAI, action called by Creature (GUID: %u Entry: %u) skipped to prevent crash.", c->GetSpawnId(), c->GetEntry(), me ? me->GetSpawnId() : 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;
@@ -91,12 +88,12 @@ bool SmartScript::IsSmart(GameObject* g, bool silent)
smart = false;
if (!smart && !silent)
- TC_LOG_ERROR("sql.sql", "SmartScript: Action target GameObject (GUID: %u Entry: %u) is not using SmartGameObjectAI, action called by GameObject (GUID: %u Entry: %u) skipped to prevent crash.", g ? g->GetSpawnId() : 0, g ? g->GetEntry() : 0, go ? go->GetSpawnId() : 0, go ? go->GetEntry() : 0);
+ TC_LOG_ERROR("sql.sql", "SmartScript: Action target GameObject (GUID: %u Entry: %u) is not using SmartGameObjectAI, action called by GameObject (GUID: %u Entry: %u) skipped to prevent crash.", g->GetSpawnId(), g->GetEntry(), go ? go->GetSpawnId() : 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 abf2033a1f9..7a533d689db 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.h
+++ b/src/server/game/AI/SmartScripts/SmartScript.h
@@ -70,9 +70,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);
ObjectVector const* GetStoredTargetVector(uint32 id, WorldObject const& ref) const;