*Try to fix the bug about crash caused by waypoint.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-26 15:46:10 -06:00
parent f6b2eb4e5b
commit c58a199db8
2 changed files with 10 additions and 4 deletions
+9 -3
View File
@@ -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<>
+1 -1
View File
@@ -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;