From a6c8b234a55b490840fd3048b50f4e8f2b8630d8 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Wed, 23 Dec 2009 22:01:03 +1300 Subject: [PATCH] linqhax --- OpenRa.Game/Game.cs | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index 4c73ee6b68..9290bd156c 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -241,21 +241,11 @@ namespace OpenRa.Game } public static bool IsActorCrushableByMovementType(Actor a, UnitMovementType umt) { - if (a != null) - { - foreach (var crush in a.traits.WithInterface()) - { - if (((crush.IsCrushableByEnemy() && a.Owner != Game.LocalPlayer) - || (crush.IsCrushableByFriend() && a.Owner == Game.LocalPlayer)) - && crush.CrushableBy(umt)) - { - Log.Write("{0} is crushable by MovementType {1}", a.Info.Name, umt); - return true; - } - } - Log.Write("{0} is NOT crushable by MovementType {1}", a.Info.Name, umt); - } - return false; + return a != null && + a.traits.WithInterface() + .Any(c => c.CrushableBy(umt) && + ((c.IsCrushableByEnemy() && a.Owner != Game.LocalPlayer) || + (c.IsCrushableByFriend() && a.Owner == Game.LocalPlayer))); } public static bool IsWater(int2 a)