From ceaca4774794ddeee9370bfc2349b277fbd74292 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 11 Jul 2011 23:17:27 +1200 Subject: [PATCH] don't use ScrollDirection.Set when it's not needed --- OpenRA.Game/Graphics/Viewport.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs index 7f77ea6c9f..666468f438 100755 --- a/OpenRA.Game/Graphics/Viewport.cs +++ b/OpenRA.Game/Graphics/Viewport.cs @@ -56,17 +56,12 @@ namespace OpenRA.Graphics public ScrollDirection GetBlockedDirections() { - ScrollDirection blockedDirections = ScrollDirection.None; - if(scrollPosition.Y <= adjustedMapBounds.Top) - blockedDirections = blockedDirections.Set(ScrollDirection.Up, true); - if(scrollPosition.X <= adjustedMapBounds.Left) - blockedDirections = blockedDirections.Set(ScrollDirection.Left, true); - if(scrollPosition.Y >= adjustedMapBounds.Bottom) - blockedDirections = blockedDirections.Set(ScrollDirection.Down, true); - if(scrollPosition.X >= adjustedMapBounds.Right) - blockedDirections = blockedDirections.Set(ScrollDirection.Right, true); - - return blockedDirections; + var ret = ScrollDirection.None; + if(scrollPosition.Y <= adjustedMapBounds.Top) ret |= ScrollDirection.Up; + if(scrollPosition.X <= adjustedMapBounds.Left) ret |= ScrollDirection.Left; + if(scrollPosition.Y >= adjustedMapBounds.Bottom) ret |= ScrollDirection.Down; + if(scrollPosition.X >= adjustedMapBounds.Right) ret |= ScrollDirection.Right; + return ret; } public Viewport(int2 screenSize, Rectangle mapBounds, Renderer renderer)