From 35b1949a61034b0c9d4b903b7043f4ff2c7647f3 Mon Sep 17 00:00:00 2001 From: Zimmermann Gyula Date: Mon, 5 Dec 2016 15:07:27 +0100 Subject: [PATCH] Use MPos during AI coarse support power targeting. --- OpenRA.Mods.Common/AI/HackyAI.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.Common/AI/HackyAI.cs b/OpenRA.Mods.Common/AI/HackyAI.cs index 4c7ccbd820..08dc73940e 100644 --- a/OpenRA.Mods.Common/AI/HackyAI.cs +++ b/OpenRA.Mods.Common/AI/HackyAI.cs @@ -1044,15 +1044,16 @@ namespace OpenRA.Mods.Common.AI return null; } + var map = World.Map; var checkRadius = powerDecision.CoarseScanRadius; - for (var i = 0; i < World.Map.MapSize.X; i += checkRadius) + for (var i = 0; i < map.MapSize.X; i += checkRadius) { - for (var j = 0; j < World.Map.MapSize.Y; j += checkRadius) + for (var j = 0; j < map.MapSize.Y; j += checkRadius) { var consideredAttractiveness = 0; - var tl = World.Map.CenterOfCell(new CPos(i, j)); - var br = World.Map.CenterOfCell(new CPos(i + checkRadius, j + checkRadius)); + var tl = World.Map.CenterOfCell(new MPos(i, j).ToCPos(map)); + var br = World.Map.CenterOfCell(new MPos(i + checkRadius, j + checkRadius).ToCPos(map)); var targets = World.ActorMap.ActorsInBox(tl, br); consideredAttractiveness = powerDecision.GetAttractiveness(targets, Player); @@ -1060,7 +1061,7 @@ namespace OpenRA.Mods.Common.AI continue; bestAttractiveness = consideredAttractiveness; - bestLocation = new CPos(i, j); + bestLocation = new MPos(i, j).ToCPos(map); } }