aboutsummaryrefslogtreecommitdiff
path: root/src/game/WaypointMovementGenerator.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-04-06 20:40:18 -0500
committermegamage <none@none>2009-04-06 20:40:18 -0500
commit8c97e8b78718ba4fa5573fa07af496a388299227 (patch)
tree859a80c6827034c9d4d04d26fac4787d0e425017 /src/game/WaypointMovementGenerator.cpp
parent9b908e4014de8d4ef428c74f94c480405160cfa7 (diff)
parentac4edf0e091f0a1e0b49ae39201183613f3453ad (diff)
*Merge.
--HG-- branch : trunk
Diffstat (limited to 'src/game/WaypointMovementGenerator.cpp')
-rw-r--r--src/game/WaypointMovementGenerator.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp
index fd2b0b8bb86..c6607b2b24e 100644
--- a/src/game/WaypointMovementGenerator.cpp
+++ b/src/game/WaypointMovementGenerator.cpp
@@ -24,6 +24,7 @@
//Creature-specific headers
#include "Creature.h"
#include "CreatureAI.h"
+#include "CreatureGroups.h"
//Player-specific
#include "Player.h"
@@ -52,9 +53,9 @@ void WaypointMovementGenerator<Creature>::MovementInform(Creature &unit)
template<>
bool WaypointMovementGenerator<Creature>::GetDestination(float &x, float &y, float &z) const
{
- if(i_destinationHolder.HasArrived())
+ if(i_destinationHolder.HasArrived())
return false;
-
+
i_destinationHolder.GetDestination(x, y, z);
return true;
}
@@ -109,6 +110,10 @@ WaypointMovementGenerator<Creature>::Initialize(Creature &u)
InitTraveller(u, *node);
i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z);
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
+
+ //Call for creature group update
+ if(u.GetFormation() && u.GetFormation()->getLeader() == &u)
+ u.GetFormation()->LeaderMoveTo(node->x, node->y, node->z);
}
else
node = NULL;
@@ -180,6 +185,10 @@ WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff)
InitTraveller(unit, *node);
i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z);
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
+
+ //Call for creature group update
+ if(unit.GetFormation() && unit.GetFormation()->getLeader() == &unit)
+ unit.GetFormation()->LeaderMoveTo(node->x, node->y, node->z);
}
else
{