aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2008-12-26 15:46:10 -0600
committermegamage <none@none>2008-12-26 15:46:10 -0600
commitc58a199db80fd3d24075582d239f782416c78de1 (patch)
tree48ed3d0a35b612e51f398c1ae02a6af06e706708 /src
parentf6b2eb4e5b0aea5e29c7220d97c420d5abeca1b8 (diff)
*Try to fix the bug about crash caused by waypoint.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/WaypointMovementGenerator.cpp12
-rw-r--r--src/game/WaypointMovementGenerator.h2
2 files changed, 10 insertions, 4 deletions
diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp
index 85ef44b51be..67c56d763bc 100644
--- a/src/game/WaypointMovementGenerator.cpp
+++ b/src/game/WaypointMovementGenerator.cpp
@@ -36,11 +36,17 @@ void
WaypointMovementGenerator<Creature>::Initialize(Creature &u)
{
u.StopMoving();
- i_nextMoveTime.Reset(0);
- i_currentNode = -1;
if(!path_id)
path_id = u.GetWaypointPath();
- waypoints = WaypointMgr.GetPath(path_id);
+ waypoints = WaypointMgr.GetPath(path_id);
+ if(waypoints && waypoints->size())
+ {
+ Traveller<Creature> traveller(unit);
+ node = *(waypoints->at(i_currentNode));
+ InitTraveller(u,node);
+ i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z);
+ i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
+ }
}
template<>
diff --git a/src/game/WaypointMovementGenerator.h b/src/game/WaypointMovementGenerator.h
index 5e01984d42c..99d111063de 100644
--- a/src/game/WaypointMovementGenerator.h
+++ b/src/game/WaypointMovementGenerator.h
@@ -81,7 +81,7 @@ class TRINITY_DLL_SPEC WaypointMovementGenerator
private:
WaypointData node;
- uint32 i_currentNode, path_id;
+ uint32 path_id;
TimeTrackerSmall i_nextMoveTime;
WaypointPath *waypoints;
bool repeating, StopedByPlayer;