mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 18:15:31 +01:00
*Update waypoint movement code. Also fix Linux build.
--HG-- branch : trunk
This commit is contained in:
@@ -1519,7 +1519,7 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
|
||||
{
|
||||
TemporarySummon* pCreature = new TemporarySummon(GetGUID());
|
||||
|
||||
pCreature->SetInstanceId(GetInstanceId());
|
||||
//pCreature->SetInstanceId(GetInstanceId());
|
||||
uint32 team = 0;
|
||||
if (GetTypeId()==TYPEID_PLAYER)
|
||||
team = ((Player*)this)->GetTeam();
|
||||
|
||||
@@ -107,7 +107,7 @@ WaypointMovementGenerator<Creature>::Initialize(Creature &u)
|
||||
Traveller<Creature> traveller(u);
|
||||
node = *(waypoints->at(i_currentNode));
|
||||
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());
|
||||
}*/
|
||||
}
|
||||
@@ -153,8 +153,8 @@ WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff)
|
||||
if(StopedByPlayer)
|
||||
{
|
||||
assert(node);
|
||||
InitTraveller(unit,node);
|
||||
i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z);
|
||||
InitTraveller(unit, *node);
|
||||
i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z);
|
||||
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
|
||||
StopedByPlayer = false;
|
||||
return true;
|
||||
@@ -166,7 +166,7 @@ WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff)
|
||||
i_currentNode = 0; //Start moving all over again
|
||||
else
|
||||
{
|
||||
unit.SetHomePosition(node.x, node.y, node.z, unit.GetOrientation());
|
||||
unit.SetHomePosition(node->x, node->y, node->z, unit.GetOrientation());
|
||||
unit.GetMotionMaster()->Initialize();
|
||||
return false; //Clear the waypoint movement
|
||||
}
|
||||
@@ -174,24 +174,24 @@ WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff)
|
||||
else
|
||||
i_currentNode++;
|
||||
|
||||
node = *(waypoints->at(i_currentNode));
|
||||
InitTraveller(unit,node);
|
||||
i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z);
|
||||
node = waypoints->at(i_currentNode);
|
||||
InitTraveller(unit, *node);
|
||||
i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z);
|
||||
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
|
||||
}
|
||||
else
|
||||
{
|
||||
//Determine waittime
|
||||
if(node.delay)
|
||||
i_nextMoveTime.Reset(node.delay);
|
||||
if(node->delay)
|
||||
i_nextMoveTime.Reset(node->delay);
|
||||
|
||||
if(node.event_id && rand()%100 < node.event_chance)
|
||||
sWorld.ScriptsStart(sWaypointScripts, node.event_id, &unit, NULL);
|
||||
if(node->event_id && rand()%100 < node->event_chance)
|
||||
sWorld.ScriptsStart(sWaypointScripts, node->event_id, &unit, NULL);
|
||||
|
||||
MovementInform(unit);
|
||||
unit.UpdateWaypointID(i_currentNode);
|
||||
unit.clearUnitState(UNIT_STAT_MOVING);
|
||||
unit.Relocate(node.x, node.y, node.z);
|
||||
unit.Relocate(node->x, node->y, node->z);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -80,7 +80,7 @@ class TRINITY_DLL_SPEC WaypointMovementGenerator
|
||||
MovementGeneratorType GetMovementGeneratorType() { return WAYPOINT_MOTION_TYPE; }
|
||||
|
||||
private:
|
||||
WaypointData node;
|
||||
WaypointData *node;
|
||||
uint32 path_id;
|
||||
TimeTrackerSmall i_nextMoveTime;
|
||||
WaypointPath *waypoints;
|
||||
|
||||
Reference in New Issue
Block a user