aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/SmartScripts
diff options
context:
space:
mode:
authorccrs <ccrs@users.noreply.github.com>2019-05-15 19:23:28 +0200
committerShauren <shauren.trinity@gmail.com>2021-12-05 16:48:58 +0100
commit844f969ed790636699eb10f660b1dc1ec012446e (patch)
tree4041900616f28737fdd146cd80c30c8f56560727 /src/server/game/AI/SmartScripts
parent672d4d6baa714d1d5fdfba890fbe38ed8b89146c (diff)
Core/AI: logs, codestyle & cosmetics standarization
(cherry picked from commit fdb71ce19e02b44323fbb9dfa5f07dae2a35f8ba)
Diffstat (limited to 'src/server/game/AI/SmartScripts')
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp6
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h27
2 files changed, 15 insertions, 18 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 4218ca172ae..b1c46fc8abc 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -45,9 +45,9 @@ bool SmartAI::IsAIControlled() const
void SmartAI::StartPath(bool run/* = false*/, uint32 pathId/* = 0*/, bool repeat/* = false*/, Unit* invoker/* = nullptr*/, uint32 nodeId/* = 1*/)
{
- if (me->IsInCombat()) // no wp movement in combat
+ if (me->IsEngaged()) // no wp movement in combat
{
- TC_LOG_ERROR("scripts.ai.sai", "SmartAI::StartPath: Creature entry %u wanted to start waypoint movement (%u) while in combat, ignoring.", me->GetEntry(), pathId);
+ TC_LOG_ERROR("scripts.ai.sai", "SmartAI::StartPath: Creature wanted to start waypoint movement (pathId: %u) while in combat, ignoring. (%s)", pathId, me->GetGUID().ToString().c_str());
return;
}
@@ -124,7 +124,7 @@ void SmartAI::PausePath(uint32 delay, bool forced)
if (HasEscortState(SMART_ESCORT_PAUSED))
{
- TC_LOG_ERROR("scripts.ai.sai", "SmartAI::PausePath: Creature entry %u wanted to pause waypoint (current waypoint: %u) movement while already paused, ignoring.", me->GetEntry(), _currentWaypointNode);
+ TC_LOG_ERROR("scripts.ai.sai", "SmartAI::PausePath: Creature wanted to pause waypoint (current waypoint: %u) movement while already paused, ignoring. (%s)", _currentWaypointNode, me->GetGUID().ToString().c_str());
return;
}
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index 26658533b2a..806902d9072 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -26,25 +26,22 @@
#include "SmartScript.h"
#include "WaypointDefines.h"
-enum SmartEscortState
+enum SmartEscortState : uint8
{
- SMART_ESCORT_NONE = 0x000, //nothing in progress
- SMART_ESCORT_ESCORTING = 0x001, //escort is in progress
- SMART_ESCORT_RETURNING = 0x002, //escort is returning after being in combat
- SMART_ESCORT_PAUSED = 0x004 //will not proceed with waypoints before state is removed
+ SMART_ESCORT_NONE = 0x00, // nothing in progress
+ SMART_ESCORT_ESCORTING = 0x01, // escort is in progress
+ SMART_ESCORT_RETURNING = 0x02, // escort is returning after being in combat
+ SMART_ESCORT_PAUSED = 0x04 // will not proceed with waypoints before state is removed
};
-enum SmartEscortVars
-{
- SMART_ESCORT_MAX_PLAYER_DIST = 60,
- SMART_MAX_AID_DIST = SMART_ESCORT_MAX_PLAYER_DIST / 2
-};
+static float constexpr SMART_ESCORT_MAX_PLAYER_DIST = 60.f;
+static float constexpr SMART_MAX_AID_DIST = SMART_ESCORT_MAX_PLAYER_DIST / 2.f;
class TC_GAME_API SmartAI : public CreatureAI
{
public:
~SmartAI() { }
- explicit SmartAI(Creature* c, uint32 scriptId = {});
+ explicit SmartAI(Creature* creature, uint32 scriptId = {});
// core related
static int32 Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
@@ -59,9 +56,9 @@ class TC_GAME_API SmartAI : public CreatureAI
void StopPath(uint32 DespawnTime = 0, uint32 quest = 0, bool fail = false);
void EndPath(bool fail = false);
void ResumePath();
- bool HasEscortState(uint32 uiEscortState) const { return (_escortState & uiEscortState) != 0; }
- void AddEscortState(uint32 uiEscortState) { _escortState |= uiEscortState; }
- void RemoveEscortState(uint32 uiEscortState) { _escortState &= ~uiEscortState; }
+ bool HasEscortState(uint32 escortState) const { return (_escortState & escortState) != 0; }
+ void AddEscortState(uint32 escortState) { _escortState |= escortState; }
+ void RemoveEscortState(uint32 escortState) { _escortState &= ~escortState; }
void SetAutoAttack(bool on) { _canAutoAttack = on; }
void SetCombatMove(bool on);
bool CanCombatMove() { return _canCombatMove; }
@@ -246,7 +243,7 @@ class TC_GAME_API SmartAI : public CreatureAI
class TC_GAME_API SmartGameObjectAI : public GameObjectAI
{
public:
- SmartGameObjectAI(GameObject* g, uint32 scriptId = {}) : GameObjectAI(g, scriptId), _gossipReturn(false) { }
+ SmartGameObjectAI(GameObject* go, uint32 scriptId = {}) : GameObjectAI(go, scriptId), _gossipReturn(false) { }
~SmartGameObjectAI() { }
void UpdateAI(uint32 diff) override;