From b96c430f84bcd0bf02a8d8cbdd82dfb040cc5853 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 27 Sep 2013 15:53:24 +1200 Subject: [PATCH] Remove PVecInt from Viewport. --- OpenRA.Game/Graphics/Viewport.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs index 93aa963343..eb3ada7af7 100755 --- a/OpenRA.Game/Graphics/Viewport.cs +++ b/OpenRA.Game/Graphics/Viewport.cs @@ -159,12 +159,10 @@ namespace OpenRA.Graphics public void Center(IEnumerable actors) { - if (!actors.Any()) return; + if (!actors.Any()) + return; - var avgPos = actors - .Select(a => (PVecInt)a.CenterLocation) - .Aggregate((a, b) => a + b) / actors.Count(); - scrollPosition = NormalizeScrollPosition((avgPos.ToFloat2() - (1f / (2 * Zoom) * screenSize.ToFloat2())).ToInt2()); + Center(actors.Select(a => a.CenterPosition).Average().ToCPos().ToFloat2()); } // Rectangle (in viewport coords) that contains things to be drawn