aboutsummaryrefslogtreecommitdiff
path: root/src/game/WaypointMovementGenerator.cpp
diff options
context:
space:
mode:
authormaximius <none@none>2009-11-19 03:53:49 -0800
committermaximius <none@none>2009-11-19 03:53:49 -0800
commit7ad284bd33b95ea40e2c0f972d843e55505c6f63 (patch)
treed898296ac295a750e29942e74b17c8d32a48dba9 /src/game/WaypointMovementGenerator.cpp
parent9953ff49b819ac2f0abf6ad08711f2193d9e9861 (diff)
*Some cleanup.
--HG-- branch : trunk
Diffstat (limited to 'src/game/WaypointMovementGenerator.cpp')
-rw-r--r--src/game/WaypointMovementGenerator.cpp62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp
index d017b09981f..0288b5bb5e5 100644
--- a/src/game/WaypointMovementGenerator.cpp
+++ b/src/game/WaypointMovementGenerator.cpp
@@ -54,7 +54,7 @@ void WaypointMovementGenerator<Creature>::MovementInform(Creature &unit)
template<>
bool WaypointMovementGenerator<Creature>::GetDestination(float &x, float &y, float &z) const
{
- if(i_destinationHolder.HasArrived())
+ if (i_destinationHolder.HasArrived())
return false;
i_destinationHolder.GetDestination(x, y, z);
@@ -97,11 +97,11 @@ WaypointMovementGenerator<Creature>::Initialize(Creature &u)
//i_currentNode = -1; // uint32, become 0 in the first update
//i_nextMoveTime.Reset(0);
StopedByPlayer = false;
- if(!path_id)
+ if (!path_id)
path_id = u.GetWaypointPath();
waypoints = WaypointMgr.GetPath(path_id);
i_currentNode = 0;
- if(waypoints && waypoints->size())
+ if (waypoints && waypoints->size())
{
node = waypoints->front();
Traveller<Creature> traveller(u);
@@ -110,7 +110,7 @@ WaypointMovementGenerator<Creature>::Initialize(Creature &u)
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
//Call for creature group update
- if(u.GetFormation() && u.GetFormation()->getLeader() == &u)
+ if (u.GetFormation() && u.GetFormation()->getLeader() == &u)
u.GetFormation()->LeaderMoveTo(node->x, node->y, node->z);
}
else
@@ -131,19 +131,19 @@ template<>
bool
WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff)
{
- if(!&unit)
+ if (!&unit)
return true;
- if(!path_id)
+ if (!path_id)
return false;
// Waypoint movement can be switched on/off
// This is quite handy for escort quests and other stuff
- if(unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
+ if (unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
return true;
// Clear the generator if the path doesn't exist
- if(!waypoints || !waypoints->size())
+ if (!waypoints || !waypoints->size())
return false;
Traveller<Creature> traveller(unit);
@@ -151,11 +151,11 @@ WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff)
i_nextMoveTime.Update(diff);
i_destinationHolder.UpdateTraveller(traveller, diff, true);
- if(i_nextMoveTime.Passed())
+ if (i_nextMoveTime.Passed())
{
- if(unit.IsStopped())
+ if (unit.IsStopped())
{
- if(StopedByPlayer)
+ if (StopedByPlayer)
{
assert(node);
InitTraveller(unit, *node);
@@ -165,15 +165,15 @@ WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff)
return true;
}
- if(i_currentNode == waypoints->size() - 1) //If that's our last waypoint
+ if (i_currentNode == waypoints->size() - 1) // If that's our last waypoint
{
- if(repeating) //If the movement is repeating
- i_currentNode = 0; //Start moving all over again
+ if (repeating) // If the movement is repeating
+ i_currentNode = 0; // Start moving all over again
else
{
unit.SetHomePosition(node->x, node->y, node->z, unit.GetOrientation());
unit.GetMotionMaster()->Initialize();
- return false; //Clear the waypoint movement
+ return false; // Clear the waypoint movement
}
}
else
@@ -185,17 +185,17 @@ WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff)
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
//Call for creature group update
- if(unit.GetFormation() && unit.GetFormation()->getLeader() == &unit)
+ if (unit.GetFormation() && unit.GetFormation()->getLeader() == &unit)
unit.GetFormation()->LeaderMoveTo(node->x, node->y, node->z);
}
else
{
//Determine waittime
- if(node->delay)
+ if (node->delay)
i_nextMoveTime.Reset(node->delay);
//note: disable "start" for mtmap
- if(node->event_id && urand(0,99) < node->event_chance)
+ if (node->event_id && urand(0,99) < node->event_chance)
unit.GetMap()->ScriptsStart(sWaypointScripts, node->event_id, &unit, NULL/*, false*/);
MovementInform(unit);
@@ -206,9 +206,9 @@ WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff)
}
else
{
- if(unit.IsStopped() && !i_destinationHolder.HasArrived())
+ if (unit.IsStopped() && !i_destinationHolder.HasArrived())
{
- if(!StopedByPlayer)
+ if (!StopedByPlayer)
{
i_destinationHolder.IncreaseTravelTime(STOP_TIME_FOR_PLAYER);
i_nextMoveTime.Reset(STOP_TIME_FOR_PLAYER);
@@ -231,13 +231,13 @@ void FlightPathMovementGenerator::LoadPath(Player &)
uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const
{
- if(i_currentNode >= i_mapIds.size())
+ if (i_currentNode >= i_mapIds.size())
return i_mapIds.size();
uint32 curMapId = i_mapIds[i_currentNode];
for (uint32 i = i_currentNode; i < i_mapIds.size(); ++i)
{
- if(i_mapIds[i] != curMapId)
+ if (i_mapIds[i] != curMapId)
return i;
}
@@ -248,13 +248,13 @@ void FlightPathMovementGenerator::Initialize(Player &player)
{
player.getHostilRefManager().setOnlineOfflineState(false);
player.addUnitState(UNIT_STAT_IN_FLIGHT);
- player.SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
+ player.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
LoadPath(player);
Traveller<Player> traveller(player);
// do not send movement, it was sent already
i_destinationHolder.SetDestination(traveller, i_path[i_currentNode].x, i_path[i_currentNode].y, i_path[i_currentNode].z, false);
- player.SendMonsterMoveByPath(GetPath(),GetCurrentNode(),GetPathAtMapEnd());
+ player.SendMonsterMoveByPath(GetPath(), GetCurrentNode(), GetPathAtMapEnd());
// Storage to preload flightmaster grid at end of flight. For multi-stop flights, this will
// be reinitialized for each flightmaster at the end of each spline (or stop) in the flight.
@@ -279,20 +279,20 @@ void FlightPathMovementGenerator::Finalize(Player & player)
bool FlightPathMovementGenerator::Update(Player &player, const uint32 &diff)
{
- if(MovementInProgress())
+ if (MovementInProgress())
{
Traveller<Player> traveller(player);
- if(i_destinationHolder.UpdateTraveller(traveller, diff))
+ if (i_destinationHolder.UpdateTraveller(traveller, diff))
{
i_destinationHolder.ResetUpdate(FLIGHT_TRAVEL_UPDATE);
- if(i_destinationHolder.HasArrived())
+ if (i_destinationHolder.HasArrived())
{
uint32 curMap = i_mapIds[i_currentNode];
++i_currentNode;
- if(MovementInProgress())
+ if (MovementInProgress())
{
DEBUG_LOG("loading node %u for player %s", i_currentNode, player.GetName());
- if(i_mapIds[i_currentNode] == curMap)
+ if (i_mapIds[i_currentNode] == curMap)
{
// do not send movement, it was sent already
i_destinationHolder.SetDestination(traveller, i_path[i_currentNode].x, i_path[i_currentNode].y, i_path[i_currentNode].z, false);
@@ -319,13 +319,13 @@ bool FlightPathMovementGenerator::Update(Player &player, const uint32 &diff)
void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport()
{
- if(i_mapIds.empty())
+ if (i_mapIds.empty())
return;
uint32 map0 = i_mapIds[0];
for (size_t i = 1; i < i_mapIds.size(); ++i)
{
- if(i_mapIds[i]!=map0)
+ if(i_mapIds[i] != map0)
{
i_currentNode = i;
return;