From 04e9cef38e634390c68f9e967cf3b17808849e46 Mon Sep 17 00:00:00 2001 From: Ashley Newson Date: Sun, 26 Jan 2025 17:17:43 +0000 Subject: [PATCH] Fix bounding of circle drawing in CellLayerUtils Previously, only the RectangularIsometric case was handled, despite this currently only being used in Rectangular mode. Additionally, the calculation was slightly off. --- .../MapGenerator/CellLayerUtils.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/MapGenerator/CellLayerUtils.cs b/OpenRA.Mods.Common/MapGenerator/CellLayerUtils.cs index 00afee5935..b60419df6f 100644 --- a/OpenRA.Mods.Common/MapGenerator/CellLayerUtils.cs +++ b/OpenRA.Mods.Common/MapGenerator/CellLayerUtils.cs @@ -218,8 +218,21 @@ namespace OpenRA.Mods.Common.MapGenerator { var mCenter = WPosToMPos(wCenter, gridType); - var mRadiusU = wRadius / 1448 + 2; - var mRadiusV = wRadius / 724 + 1; + int mRadiusU; + int mRadiusV; + switch (gridType) + { + case MapGridType.Rectangular: + mRadiusU = wRadius / 1024 + 1; + mRadiusV = wRadius / 1024 + 1; + break; + case MapGridType.RectangularIsometric: + mRadiusU = wRadius / 1448 + 2; + mRadiusV = wRadius / 724 + 2; + break; + default: + throw new NotImplementedException(); + } minU = Math.Max(mCenter.U - mRadiusU, 0); minV = Math.Max(mCenter.V - mRadiusV, 0);