From 1f65fd234b6294af8d8e21560c6beb99cbde269c Mon Sep 17 00:00:00 2001 From: Ashley Newson Date: Fri, 7 Feb 2025 23:16:06 +0000 Subject: [PATCH] Use long in CellLayerUtils.CalibrateQuantileInPlace index calculation This is similar to #21727, but in CellLayerUtils instead of MatrixUtils. Note that the lack of long does not result in any overflows/crashes in existing code, but can cause crashes for new features requiring larger calculations. --- OpenRA.Mods.Common/MapGenerator/CellLayerUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/MapGenerator/CellLayerUtils.cs b/OpenRA.Mods.Common/MapGenerator/CellLayerUtils.cs index 6535e2b6be..3a2344d9da 100644 --- a/OpenRA.Mods.Common/MapGenerator/CellLayerUtils.cs +++ b/OpenRA.Mods.Common/MapGenerator/CellLayerUtils.cs @@ -275,7 +275,7 @@ namespace OpenRA.Mods.Common.MapGenerator { var sorted = Entries(cellLayer); Array.Sort(sorted); - var adjustment = target - sorted[(sorted.Length - 1) * count / outOf]; + var adjustment = target - sorted[(long)(sorted.Length - 1) * count / outOf]; foreach (var mpos in cellLayer.CellRegion.MapCoords) cellLayer[mpos] += adjustment; }