diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index 091705e00b..acaf24036b 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -168,7 +168,7 @@ namespace OpenRA.Mods.Common.Traits public int CalculateTilesetMovementClass(TileSet tileset) { - /* collect our ability to cross *all* terraintypes, in a bitvector */ + // collect our ability to cross *all* terraintypes, in a bitvector return TilesetTerrainInfo[tileset].Select(ti => ti.Cost < int.MaxValue).ToBits(); } @@ -180,12 +180,12 @@ namespace OpenRA.Mods.Common.Traits static bool IsMovingInMyDirection(Actor self, Actor other) { var selfMobile = self.TraitOrDefault(); - if (selfMobile == null) return false; + if (selfMobile == null) + return false; var otherMobile = other.TraitOrDefault(); - if (otherMobile == null) return false; - - if (!otherMobile.IsMoving) return false; + if (otherMobile == null || !otherMobile.IsMoving) + return false; // Sign of dot-product indicates (roughly) if vectors are facing in same or opposite directions: var dp = CVec.Dot(selfMobile.ToCell - self.Location, otherMobile.ToCell - other.Location);