Some cleanups. (might break build for scripts as they are a WIP)

This commit is contained in:
hondacrx
2023-10-08 10:35:31 -04:00
parent fa10b981bd
commit cda53c8e7f
208 changed files with 2266 additions and 2329 deletions
@@ -55,7 +55,7 @@ namespace Game.Movement
public override bool Update(Unit owner, uint diff)
{
// owner might be dead or gone (can we even get nullptr here?)
if (!owner || !owner.IsAlive())
if (owner == null || !owner.IsAlive())
return false;
// our target might have gone away
@@ -162,7 +162,7 @@ namespace Game.Movement
bool success = _path.CalculatePath(x, y, z, owner.CanFly());
if (!success || _path.GetPathType().HasAnyFlag(PathType.NoPath))
{
if (cOwner)
if (cOwner != null)
cOwner.SetCannotReachTarget(true);
owner.StopMoving();
@@ -172,11 +172,11 @@ namespace Game.Movement
if (shortenPath)
_path.ShortenPathUntilDist(target, maxTarget);
if (cOwner)
if (cOwner != null)
cOwner.SetCannotReachTarget(false);
bool walk = false;
if (cOwner && !cOwner.IsPet())
if (cOwner != null && !cOwner.IsPet())
{
switch (cOwner.GetMovementTemplate().GetChase())
{
@@ -25,7 +25,7 @@ namespace Game.Movement
RemoveFlag(MovementGeneratorFlags.InitializationPending | MovementGeneratorFlags.Transitory | MovementGeneratorFlags.Deactivated);
AddFlag(MovementGeneratorFlags.Initialized);
if (!owner || !owner.IsAlive())
if (owner == null || !owner.IsAlive())
return;
// TODO: UNIT_FIELD_FLAGS should not be handled by generators
@@ -45,7 +45,7 @@ namespace Game.Movement
public override bool DoUpdate(T owner, uint diff)
{
if (!owner || !owner.IsAlive())
if (owner == null || !owner.IsAlive())
return false;
if (owner.HasUnitState(UnitState.NotMove) || owner.IsMovementPreventedByCasting())
@@ -124,7 +124,7 @@ namespace Game.Movement
{
owner.RemoveUnitFlag(UnitFlags.Confused);
owner.ClearUnitState(UnitState.ConfusedMove);
if (owner.GetVictim())
if (owner.GetVictim() != null)
owner.SetTarget(owner.GetVictim().GetGUID());
}
}
@@ -189,7 +189,7 @@ namespace Game.Movement
Pet oPet = owner.ToPet();
if (oPet != null)
{
if (!_abstractFollower.GetTarget() || _abstractFollower.GetTarget().GetGUID() == owner.GetOwnerGUID())
if (_abstractFollower.GetTarget() == null || _abstractFollower.GetTarget().GetGUID() == owner.GetOwnerGUID())
{
oPet.UpdateSpeed(UnitMoveType.Run);
oPet.UpdateSpeed(UnitMoveType.Walk);
@@ -56,7 +56,7 @@ namespace Game.Movement
public override bool Update(Unit owner, uint diff)
{
if (!owner || HasFlag(MovementGeneratorFlags.Finalized))
if (owner == null || HasFlag(MovementGeneratorFlags.Finalized))
return false;
// Cyclic splines never expire, so update the duration only if it's not cyclic
@@ -87,7 +87,7 @@ namespace Game.Movement
if (_speed.HasValue)
init.SetVelocity(_speed.Value);
if (_faceTarget)
if (_faceTarget != null)
init.SetFacing(_faceTarget);
if (_spellEffectExtra != null)
@@ -59,7 +59,7 @@ namespace Game.Movement
public override bool DoUpdate(Creature owner, uint diff)
{
if (!owner || !owner.IsAlive())
if (owner == null || !owner.IsAlive())
return true;
if (HasFlag(MovementGeneratorFlags.Finalized | MovementGeneratorFlags.Paused))
@@ -160,7 +160,7 @@ namespace Game.Movement
public override bool DoUpdate(Creature owner, uint diff)
{
if (!owner || !owner.IsAlive())
if (owner == null || !owner.IsAlive())
return true;
if (HasFlag(MovementGeneratorFlags.Finalized | MovementGeneratorFlags.Paused) || _path == null || _path.nodes.Empty())
@@ -363,7 +363,7 @@ namespace Game.Movement
trans.CalculatePassengerPosition(ref x, ref y, ref z, ref o);
owner.SetHomePosition(x, y, z, o);
}
// else if (vehicle) - this should never happen, vehicle offsets are const
// else if (vehicle != null) - this should never happen, vehicle offsets are const
}
AddFlag(MovementGeneratorFlags.Finalized);