From be59d045cea90a53b907fd00b3ef51cfd94e1115 Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Thu, 20 Aug 2015 19:37:35 +0100 Subject: [PATCH] Only enumerate crushable traits once in MobileInfo.IsBlockedBy. --- OpenRA.Mods.Common/Traits/Mobile.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index b3249393db..444cfac766 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -242,11 +242,17 @@ namespace OpenRA.Mods.Common.Traits // If the other actor in our way cannot be crushed, we are blocked. var crushables = otherActor.TraitsImplementing(); - if (!crushables.Any()) - return true; + var lacksCrushability = true; foreach (var crushable in crushables) + { + lacksCrushability = false; if (!crushable.CrushableBy(Crushes, self.Owner)) return true; + } + + // If there are no crushable traits at all, this means the other actor cannot be crushed - we are blocked. + if (lacksCrushability) + return true; // We are not blocked by the other actor. return false;