From 8a9a9f88cc67f22a4f06463df01d7681fd9c81ff Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 31 Dec 2008 10:46:43 -0600 Subject: [PATCH] *Fix the crash bug of waypoint movement. --HG-- branch : trunk --- src/game/WaypointMovementGenerator.cpp | 14 ++++++++------ src/game/WaypointMovementGenerator.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index c4025d9de5e..b44c44aaff7 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -95,21 +95,23 @@ void WaypointMovementGenerator::Initialize(Creature &u) { u.StopMoving(); - i_currentNode = -1; // uint32, become 0 in the first update - i_nextMoveTime.Reset(0); + //i_currentNode = -1; // uint32, become 0 in the first update + //i_nextMoveTime.Reset(0); StopedByPlayer = false; if(!path_id) path_id = u.GetWaypointPath(); waypoints = WaypointMgr.GetPath(path_id); - /*i_currentNode = 0; + i_currentNode = 0; if(waypoints && waypoints->size()) { + node = waypoints->front(); Traveller traveller(u); - node = *(waypoints->at(i_currentNode)); - InitTraveller(u,node); + InitTraveller(u, *node); i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z); i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); - }*/ + } + else + node = NULL; } template<> diff --git a/src/game/WaypointMovementGenerator.h b/src/game/WaypointMovementGenerator.h index 899c55a5925..e9c806a4f7d 100644 --- a/src/game/WaypointMovementGenerator.h +++ b/src/game/WaypointMovementGenerator.h @@ -67,7 +67,7 @@ class TRINITY_DLL_SPEC WaypointMovementGenerator { public: WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true) : - i_nextMoveTime(0), path_id(_path_id), repeating(_repeating), StopedByPlayer(false){} + i_nextMoveTime(0), path_id(_path_id), repeating(_repeating), StopedByPlayer(false), node(NULL) {} void Initialize(T &); void Finalize(T &);