[Sync] Some long overdue project sync

This commit is contained in:
Antz 2019-01-08 23:04:45 +00:00 committed by Antz
parent a479a2ccc5
commit 65ec4ea06e
76 changed files with 1693 additions and 1489 deletions

View file

@ -38,10 +38,10 @@ template<class T, typename D>
void TargetedMovementGeneratorMedium<T, D>::_setTargetLocation(T& owner, bool updateDestination)
{
if (!i_target.isValid() || !i_target->IsInWorld())
return;
{ return; }
if (owner.hasUnitState(UNIT_STAT_NOT_MOVE))
return;
{ return; }
float x, y, z;
@ -55,7 +55,7 @@ void TargetedMovementGeneratorMedium<T, D>::_setTargetLocation(T& owner, bool up
if (!RequiresNewPosition(owner, x, y, z))
{
if (!owner.movespline->Finalized())
return;
{ return; }
}
// Chase Movement and angle == 0 case: Chase to current angle
else if (this->GetMovementGeneratorType() == CHASE_MOTION_TYPE && i_angle == 0.0f)
@ -78,14 +78,14 @@ void TargetedMovementGeneratorMedium<T, D>::_setTargetLocation(T& owner, bool up
}
if (!i_path)
i_path = new PathFinder(&owner);
{ i_path = new PathFinder(&owner); }
// allow pets following their master to cheat while generating paths
bool forceDest = (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->IsPet()
&& owner.hasUnitState(UNIT_STAT_FOLLOW));
i_path->calculate(x, y, z, forceDest);
if (i_path->getPathType() & PATHFIND_NOPATH)
return;
{ return; }
D::_addUnitStateMove(owner);
i_targetReached = false;
@ -101,10 +101,10 @@ template<class T, typename D>
bool TargetedMovementGeneratorMedium<T, D>::Update(T& owner, const uint32& time_diff)
{
if (!i_target.isValid() || !i_target->IsInWorld())
return false;
{ return false; }
if (!owner.IsAlive())
return true;
{ return true; }
if (owner.hasUnitState(UNIT_STAT_NOT_MOVE))
{
@ -122,7 +122,7 @@ bool TargetedMovementGeneratorMedium<T, D>::Update(T& owner, const uint32& time_
if (owner.IsNonMeleeSpellCasted(false, false, true))
{
if (!owner.IsStopped())
owner.StopMoving();
{ owner.StopMoving(); }
return true;
}
@ -139,17 +139,16 @@ bool TargetedMovementGeneratorMedium<T, D>::Update(T& owner, const uint32& time_
{
i_recheckDistance.Reset(this->GetMovementGeneratorType() == FOLLOW_MOTION_TYPE ? 50 : 100);
G3D::Vector3 dest = owner.movespline->FinalDestination();
targetMoved = RequiresNewPosition(owner, dest.x, dest.y, dest.z);
}
if (m_speedChanged || targetMoved)
_setTargetLocation(owner, targetMoved);
{ _setTargetLocation(owner, targetMoved); }
if (owner.movespline->Finalized())
{
if (i_angle == 0.f && !owner.HasInArc(0.01f, i_target.getTarget()))
owner.SetInFront(i_target.getTarget());
{ owner.SetInFront(i_target.getTarget()); }
if (!i_targetReached)
{
@ -171,9 +170,9 @@ bool TargetedMovementGeneratorMedium<T, D>::RequiresNewPosition(T& owner, float
{
// More distance let have better performance, less distance let have more sensitive reaction at target move.
if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->CanFly())
return !i_target->IsWithinDist3d(x, y, z, this->GetDynamicTargetDistance(owner, true));
{ return !i_target->IsWithinDist3d(x, y, z, this->GetDynamicTargetDistance(owner, true)); }
else
return !i_target->IsWithinDist2d(x, y, this->GetDynamicTargetDistance(owner, true));
{ return !i_target->IsWithinDist2d(x, y, this->GetDynamicTargetDistance(owner, true)); }
}
//-----------------------------------------------//
@ -192,7 +191,7 @@ template<class T>
void ChaseMovementGenerator<T>::_reachTarget(T& owner)
{
if (owner.CanReachWithMeleeAttack(this->i_target.getTarget()))
owner.Attack(this->i_target.getTarget(), true);
{ owner.Attack(this->i_target.getTarget(), true); }
}
template<>
@ -237,7 +236,7 @@ template<class T>
float ChaseMovementGenerator<T>::GetDynamicTargetDistance(T& owner, bool forRangeCheck) const
{
if (!forRangeCheck)
return this->i_offset + CHASE_DEFAULT_RANGE_FACTOR * this->i_target->GetCombatReach(&owner);
{ return this->i_offset + CHASE_DEFAULT_RANGE_FACTOR * this->i_target->GetCombatReach(&owner); }
return CHASE_RECHASE_RANGE_FACTOR * this->i_target->GetCombatReach(&owner) - this->i_target->GetObjectBoundingRadius();
}
@ -261,7 +260,7 @@ bool FollowMovementGenerator<Player>::EnableWalking() const
}
template<>
void FollowMovementGenerator<Player>::_updateSpeed(Player &/*u*/)
void FollowMovementGenerator<Player>::_updateSpeed(Player& /*u*/)
{
// nothing to do for Player
}
@ -271,7 +270,7 @@ void FollowMovementGenerator<Creature>::_updateSpeed(Creature& u)
{
// pet only sync speed with owner
if (!((Creature&)u).IsPet() || !i_target.isValid() || i_target->GetObjectGuid() != u.GetOwnerGuid())
return;
{ return; }
u.UpdateSpeed(MOVE_RUN, true);
u.UpdateSpeed(MOVE_WALK, true);
@ -327,12 +326,12 @@ template<class T>
float FollowMovementGenerator<T>::GetDynamicTargetDistance(T& owner, bool forRangeCheck) const
{
if (!forRangeCheck)
return this->i_offset + owner.GetObjectBoundingRadius() + this->i_target->GetObjectBoundingRadius();
{ return this->i_offset + owner.GetObjectBoundingRadius() + this->i_target->GetObjectBoundingRadius(); }
float allowed_dist = sWorld.getConfig(CONFIG_FLOAT_RATE_TARGET_POS_RECALCULATION_RANGE) - this->i_target->GetObjectBoundingRadius();
allowed_dist += FOLLOW_RECALCULATE_FACTOR * (owner.GetObjectBoundingRadius() + this->i_target->GetObjectBoundingRadius());
if (this->i_offset > FOLLOW_DIST_GAP_FOR_DIST_FACTOR)
allowed_dist += FOLLOW_DIST_RECALCULATE_FACTOR * this->i_offset;
{ allowed_dist += FOLLOW_DIST_RECALCULATE_FACTOR * this->i_offset; }
return allowed_dist;
}