aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/CoreAI/UnitAI.h5
-rw-r--r--src/server/game/AI/CreatureAI.h7
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp5
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h2
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp10
5 files changed, 16 insertions, 13 deletions
diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h
index 2c7eb65b5cf..6fa79fd7c25 100644
--- a/src/server/game/AI/CoreAI/UnitAI.h
+++ b/src/server/game/AI/CoreAI/UnitAI.h
@@ -320,11 +320,6 @@ class TC_GAME_API UnitAI
// Called when a game event starts or ends
virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) { }
- virtual void WaypointPathStarted(uint32 /*nodeId*/, uint32 /*pathId*/) { }
- virtual void WaypointStarted(uint32 /*nodeId*/, uint32 /*pathId*/) { }
- virtual void WaypointReached(uint32 /*nodeId*/, uint32 /*pathId*/) { }
- virtual void WaypointPathEnded(uint32 /*nodeId*/, uint32 /*pathId*/) { }
-
private:
UnitAI(UnitAI const& right) = delete;
UnitAI& operator=(UnitAI const& right) = delete;
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h
index a918ecb0559..e1910fdc2d1 100644
--- a/src/server/game/AI/CreatureAI.h
+++ b/src/server/game/AI/CreatureAI.h
@@ -197,6 +197,13 @@ class TC_GAME_API CreatureAI : public UnitAI
// Called when a player completes a quest and is rewarded, opt is the selected item's index or 0
virtual void QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { }
+ /// == Waypoints system =============================
+
+ virtual void WaypointPathStarted(uint32 /*pathId*/) { }
+ virtual void WaypointStarted(uint32 /*nodeId*/, uint32 /*pathId*/) { }
+ virtual void WaypointReached(uint32 /*nodeId*/, uint32 /*pathId*/) { }
+ virtual void WaypointPathEnded(uint32 /*nodeId*/, uint32 /*pathId*/) { }
+
/// == Fields =======================================
virtual void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool /*apply*/) { }
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 8b12c40ccb2..2b815b677a3 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -340,11 +340,12 @@ bool SmartAI::IsEscortInvokerInRange()
}
///@todo move escort related logic
-void SmartAI::WaypointPathStarted(uint32 nodeId, uint32 pathId)
+void SmartAI::WaypointPathStarted(uint32 pathId)
{
if (!HasEscortState(SMART_ESCORT_ESCORTING))
{
- GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, nullptr, nodeId, pathId);
+ // @todo remove the constant 1 at some point, it's never anything different
+ GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, nullptr, 1, pathId);
return;
}
}
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index 20f607d476f..35b7d534e19 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -68,7 +68,7 @@ class TC_GAME_API SmartAI : public CreatureAI
void StopFollow(bool complete);
bool IsEscortInvokerInRange();
- void WaypointPathStarted(uint32 nodeId, uint32 pathId) override;
+ void WaypointPathStarted(uint32 pathId) override;
void WaypointStarted(uint32 nodeId, uint32 pathId) override;
void WaypointReached(uint32 nodeId, uint32 pathId) override;
void WaypointPathEnded(uint32 nodeId, uint32 pathId) override;
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
index 15d2d0b3fa2..779a8893751 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
@@ -58,8 +58,8 @@ void WaypointMovementGenerator<Creature>::LoadPath(Creature* creature)
_nextMoveTime.Reset(1000);
// inform AI
- if (creature->AI())
- creature->AI()->WaypointPathStarted(1, _path->id);
+ if (creature->IsAIEnabled)
+ creature->AI()->WaypointPathStarted(_path->id);
}
void WaypointMovementGenerator<Creature>::DoInitialize(Creature* creature)
@@ -107,7 +107,7 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature* creature)
}
// inform AI
- if (creature->AI())
+ if (creature->IsAIEnabled)
{
creature->AI()->MovementInform(WAYPOINT_MOTION_TYPE, _currentNode);
creature->AI()->WaypointReached(waypoint.id, _path->id);
@@ -164,7 +164,7 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
creature->UpdateCurrentWaypointInfo(0, 0);
// inform AI
- if (creature->AI())
+ if (creature->IsAIEnabled)
creature->AI()->WaypointPathEnded(waypoint.id, _path->id);
return true;
}
@@ -172,7 +172,7 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
_currentNode = (_currentNode + 1) % _path->nodes.size();
// inform AI
- if (creature->AI())
+ if (creature->IsAIEnabled)
creature->AI()->WaypointStarted(waypoint.id, _path->id);
}