Core/Cleanup:
Mostly if(.. -> if (.. and for(.. -> for (.. but also some miscellaneous cleanup
This commit is contained in:
@@ -28,8 +28,7 @@
|
||||
#define MAX_QUIET_DISTANCE 43.0f
|
||||
|
||||
template<class T>
|
||||
void
|
||||
FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
||||
void FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
||||
{
|
||||
if (!&owner)
|
||||
return;
|
||||
@@ -53,8 +52,7 @@ FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
||||
}
|
||||
|
||||
template<class T>
|
||||
bool
|
||||
FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
|
||||
bool FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
|
||||
{
|
||||
if (!&owner)
|
||||
return false;
|
||||
@@ -65,8 +63,8 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
|
||||
|
||||
float temp_x, temp_y, angle;
|
||||
const Map* _map = owner.GetBaseMap();
|
||||
//primitive path-finding
|
||||
for(uint8 i = 0; i < 18; ++i)
|
||||
// primitive path-finding
|
||||
for (uint8 i = 0; i < 18; ++i)
|
||||
{
|
||||
if (i_only_forward && i > 2)
|
||||
break;
|
||||
@@ -187,8 +185,7 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
|
||||
}
|
||||
|
||||
template<class T>
|
||||
bool
|
||||
FleeingMovementGenerator<T>::_setMoveData(T &owner)
|
||||
bool FleeingMovementGenerator<T>::_setMoveData(T &owner)
|
||||
{
|
||||
float cur_dist_xyz = owner.GetDistance(i_caster_x, i_caster_y, i_caster_z);
|
||||
|
||||
@@ -280,8 +277,7 @@ FleeingMovementGenerator<T>::_setMoveData(T &owner)
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void
|
||||
FleeingMovementGenerator<T>::Initialize(T &owner)
|
||||
void FleeingMovementGenerator<T>::Initialize(T &owner)
|
||||
{
|
||||
if (!&owner)
|
||||
return;
|
||||
@@ -312,8 +308,7 @@ FleeingMovementGenerator<T>::Initialize(T &owner)
|
||||
}
|
||||
|
||||
template<>
|
||||
void
|
||||
FleeingMovementGenerator<Creature>::_Init(Creature &owner)
|
||||
void FleeingMovementGenerator<Creature>::_Init(Creature &owner)
|
||||
{
|
||||
if (!&owner)
|
||||
return;
|
||||
@@ -324,8 +319,7 @@ FleeingMovementGenerator<Creature>::_Init(Creature &owner)
|
||||
}
|
||||
|
||||
template<>
|
||||
void
|
||||
FleeingMovementGenerator<Player>::_Init(Player &)
|
||||
void FleeingMovementGenerator<Player>::_Init(Player &)
|
||||
{
|
||||
is_water_ok = true;
|
||||
is_land_ok = true;
|
||||
@@ -354,8 +348,7 @@ void FleeingMovementGenerator<T>::Reset(T &owner)
|
||||
}
|
||||
|
||||
template<class T>
|
||||
bool
|
||||
FleeingMovementGenerator<T>::Update(T &owner, const uint32 &time_diff)
|
||||
bool FleeingMovementGenerator<T>::Update(T &owner, const uint32 &time_diff)
|
||||
{
|
||||
if (!&owner || !owner.isAlive())
|
||||
return false;
|
||||
|
||||
@@ -22,8 +22,7 @@
|
||||
#include "MovementGenerator.h"
|
||||
|
||||
template<class T>
|
||||
class FleeingMovementGenerator
|
||||
: public MovementGeneratorMedium< T, FleeingMovementGenerator<T> >
|
||||
class FleeingMovementGenerator : public MovementGeneratorMedium< T, FleeingMovementGenerator<T> >
|
||||
{
|
||||
public:
|
||||
FleeingMovementGenerator(uint64 fright) : i_frightGUID(fright), i_nextCheckTime(0) {}
|
||||
@@ -55,8 +54,7 @@ class FleeingMovementGenerator
|
||||
TimeTracker i_nextCheckTime;
|
||||
};
|
||||
|
||||
class TimedFleeingMovementGenerator
|
||||
: public FleeingMovementGenerator<Creature>
|
||||
class TimedFleeingMovementGenerator : public FleeingMovementGenerator<Creature>
|
||||
{
|
||||
public:
|
||||
TimedFleeingMovementGenerator(uint64 fright, uint32 time) :
|
||||
|
||||
@@ -27,8 +27,7 @@ template < class T >
|
||||
class HomeMovementGenerator;
|
||||
|
||||
template <>
|
||||
class HomeMovementGenerator<Creature>
|
||||
: public MovementGeneratorMedium< Creature, HomeMovementGenerator<Creature> >
|
||||
class HomeMovementGenerator<Creature> : public MovementGeneratorMedium< Creature, HomeMovementGenerator<Creature> >
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 & /*diff*/)
|
||||
if (!&unit)
|
||||
return false;
|
||||
|
||||
if(unit.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED))
|
||||
if (unit.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED))
|
||||
{
|
||||
unit.ClearUnitState(UNIT_STATE_ROAMING_MOVE);
|
||||
return true;
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
#include "FollowerReference.h"
|
||||
|
||||
template<class T>
|
||||
class PointMovementGenerator
|
||||
: public MovementGeneratorMedium< T, PointMovementGenerator<T> >
|
||||
class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementGenerator<T> >
|
||||
{
|
||||
public:
|
||||
PointMovementGenerator(uint32 _id, float _x, float _y, float _z, float _speed = 0.0f) : id(_id),
|
||||
@@ -46,8 +45,7 @@ class PointMovementGenerator
|
||||
float speed;
|
||||
};
|
||||
|
||||
class AssistanceMovementGenerator
|
||||
: public PointMovementGenerator<Creature>
|
||||
class AssistanceMovementGenerator : public PointMovementGenerator<Creature>
|
||||
{
|
||||
public:
|
||||
AssistanceMovementGenerator(float _x, float _y, float _z) :
|
||||
|
||||
@@ -127,8 +127,7 @@ void RandomMovementGenerator<Creature>::Initialize(Creature &creature)
|
||||
}
|
||||
|
||||
template<>
|
||||
void
|
||||
RandomMovementGenerator<Creature>::Reset(Creature &creature)
|
||||
void RandomMovementGenerator<Creature>::Reset(Creature &creature)
|
||||
{
|
||||
Initialize(creature);
|
||||
}
|
||||
@@ -141,8 +140,7 @@ void RandomMovementGenerator<Creature>::Finalize(Creature &creature)
|
||||
}
|
||||
|
||||
template<>
|
||||
bool
|
||||
RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 diff)
|
||||
bool RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 diff)
|
||||
{
|
||||
if (creature.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED))
|
||||
{
|
||||
|
||||
@@ -22,8 +22,7 @@
|
||||
#include "MovementGenerator.h"
|
||||
|
||||
template<class T>
|
||||
class RandomMovementGenerator
|
||||
: public MovementGeneratorMedium< T, RandomMovementGenerator<T> >
|
||||
class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovementGenerator<T> >
|
||||
{
|
||||
public:
|
||||
RandomMovementGenerator(float spawn_dist = 0.0f) : i_nextMoveTime(0), wander_distance(spawn_dist) {}
|
||||
|
||||
@@ -78,7 +78,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T &owner)
|
||||
|
||||
//We don't update Mob Movement, if the difference between New destination and last destination is < BothObjectSize
|
||||
float bothObjectSize = i_target->GetObjectBoundingRadius() + owner.GetObjectBoundingRadius() + CONTACT_DISTANCE;
|
||||
if( i_destinationHolder.HasDestination() && i_destinationHolder.GetDestinationDiff(x,y,z) < bothObjectSize )
|
||||
if ( i_destinationHolder.HasDestination() && i_destinationHolder.GetDestinationDiff(x,y,z) < bothObjectSize )
|
||||
return;
|
||||
*/
|
||||
|
||||
|
||||
@@ -34,8 +34,7 @@ class TargetedMovementGeneratorBase
|
||||
};
|
||||
|
||||
template<class T, typename D>
|
||||
class TargetedMovementGeneratorMedium
|
||||
: public MovementGeneratorMedium< T, D >, public TargetedMovementGeneratorBase
|
||||
class TargetedMovementGeneratorMedium : public MovementGeneratorMedium< T, D >, public TargetedMovementGeneratorBase
|
||||
{
|
||||
protected:
|
||||
TargetedMovementGeneratorMedium(Unit &target, float offset, float angle) :
|
||||
|
||||
@@ -58,9 +58,8 @@ template<class T>
|
||||
class WaypointMovementGenerator;
|
||||
|
||||
template<>
|
||||
class WaypointMovementGenerator<Creature>
|
||||
: public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >,
|
||||
public PathMovementBase<Creature, WaypointPath const*>
|
||||
class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >,
|
||||
public PathMovementBase<Creature, WaypointPath const*>
|
||||
{
|
||||
public:
|
||||
WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true)
|
||||
@@ -110,9 +109,8 @@ public PathMovementBase<Creature, WaypointPath const*>
|
||||
/** FlightPathMovementGenerator generates movement of the player for the paths
|
||||
* and hence generates ground and activities for the player.
|
||||
*/
|
||||
class FlightPathMovementGenerator
|
||||
: public MovementGeneratorMedium< Player, FlightPathMovementGenerator >,
|
||||
public PathMovementBase<Player, TaxiPathNodeList const*>
|
||||
class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, FlightPathMovementGenerator >,
|
||||
public PathMovementBase<Player, TaxiPathNodeList const*>
|
||||
{
|
||||
public:
|
||||
explicit FlightPathMovementGenerator(TaxiPathNodeList const& pathnodes, uint32 startNode = 0)
|
||||
|
||||
@@ -288,7 +288,7 @@ std::string MoveSpline::ToString() const
|
||||
str << "facing angle: " << facing.angle;
|
||||
else if (splineflags.final_target)
|
||||
str << "facing target: " << facing.target;
|
||||
else if(splineflags.final_point)
|
||||
else if (splineflags.final_point)
|
||||
str << "facing point: " << facing.f.x << " " << facing.f.y << " " << facing.f.z;
|
||||
str << std::endl;
|
||||
str << "time passed: " << time_passed << std::endl;
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace Movement
|
||||
Vector3 middle = (real_path[0] + real_path[last_idx]) / 2.f;
|
||||
Vector3 offset;
|
||||
// first and last points already appended
|
||||
for(uint32 i = 1; i < last_idx; ++i)
|
||||
for (uint32 i = 1; i < last_idx; ++i)
|
||||
{
|
||||
offset = middle - real_path[i];
|
||||
data.appendPackXYZ(offset.x, offset.y, offset.z);
|
||||
@@ -169,7 +169,7 @@ namespace Movement
|
||||
{
|
||||
data << move_spline.facing.target;
|
||||
}
|
||||
else if(splineFlags.final_point)
|
||||
else if (splineFlags.final_point)
|
||||
{
|
||||
data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user