*Fix the crash bug of waypoint movement.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-31 10:46:43 -06:00
parent 3885ce94d9
commit 8a9a9f88cc
2 changed files with 9 additions and 7 deletions
+8 -6
View File
@@ -95,21 +95,23 @@ void
WaypointMovementGenerator<Creature>::Initialize(Creature &u) WaypointMovementGenerator<Creature>::Initialize(Creature &u)
{ {
u.StopMoving(); u.StopMoving();
i_currentNode = -1; // uint32, become 0 in the first update //i_currentNode = -1; // uint32, become 0 in the first update
i_nextMoveTime.Reset(0); //i_nextMoveTime.Reset(0);
StopedByPlayer = false; StopedByPlayer = false;
if(!path_id) if(!path_id)
path_id = u.GetWaypointPath(); path_id = u.GetWaypointPath();
waypoints = WaypointMgr.GetPath(path_id); waypoints = WaypointMgr.GetPath(path_id);
/*i_currentNode = 0; i_currentNode = 0;
if(waypoints && waypoints->size()) if(waypoints && waypoints->size())
{ {
node = waypoints->front();
Traveller<Creature> traveller(u); Traveller<Creature> traveller(u);
node = *(waypoints->at(i_currentNode)); InitTraveller(u, *node);
InitTraveller(u,node);
i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z); i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z);
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime()); i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
}*/ }
else
node = NULL;
} }
template<> template<>
+1 -1
View File
@@ -67,7 +67,7 @@ class TRINITY_DLL_SPEC WaypointMovementGenerator
{ {
public: public:
WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true) : 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 Initialize(T &);
void Finalize(T &); void Finalize(T &);