Remove checks for self being null in Mobile.cs.

This commit is contained in:
RoosterDragon
2016-02-05 22:11:11 +00:00
parent ddea517b19
commit 4b308dee02

View File

@@ -179,7 +179,6 @@ namespace OpenRA.Mods.Common.Traits
static bool IsMovingInMyDirection(Actor self, Actor other) static bool IsMovingInMyDirection(Actor self, Actor other)
{ {
if (!other.IsMoving()) return false; if (!other.IsMoving()) return false;
if (self == null) return true;
var selfMobile = self.TraitOrDefault<Mobile>(); var selfMobile = self.TraitOrDefault<Mobile>();
if (selfMobile == null) return false; if (selfMobile == null) return false;
@@ -235,7 +234,6 @@ namespace OpenRA.Mods.Common.Traits
// If the check allows: we are not blocked by allied units moving in our direction. // If the check allows: we are not blocked by allied units moving in our direction.
if (!check.HasCellCondition(CellConditions.BlockedByMovers) && if (!check.HasCellCondition(CellConditions.BlockedByMovers) &&
self != null &&
self.Owner.Stances[otherActor.Owner] == Stance.Ally && self.Owner.Stances[otherActor.Owner] == Stance.Ally &&
IsMovingInMyDirection(self, otherActor)) IsMovingInMyDirection(self, otherActor))
return false; return false;
@@ -246,7 +244,7 @@ namespace OpenRA.Mods.Common.Traits
return false; return false;
// If we cannot crush the other actor in our way, we are blocked. // If we cannot crush the other actor in our way, we are blocked.
if (self == null || Crushes == null || Crushes.Count == 0) if (Crushes == null || Crushes.Count == 0)
return true; return true;
// If the other actor in our way cannot be crushed, we are blocked. // If the other actor in our way cannot be crushed, we are blocked.