From c8cf658d465c11e89b621746ab97104c707254d0 Mon Sep 17 00:00:00 2001 From: Fabio Pedretti Date: Thu, 1 Oct 2026 13:02:50 +0200 Subject: [PATCH] Remove unused heightmap clone The clone of g_Map.height was only used to read its length, while all neighbor heights are read from g_Map itself. Cloning the whole heightmap on every iteration was therefore pure overhead. --- .../public/maps/random/rmgen/painter/SmoothingPainter.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/binaries/data/mods/public/maps/random/rmgen/painter/SmoothingPainter.js b/binaries/data/mods/public/maps/random/rmgen/painter/SmoothingPainter.js index f06f2dc218..6883b0dd33 100644 --- a/binaries/data/mods/public/maps/random/rmgen/painter/SmoothingPainter.js +++ b/binaries/data/mods/public/maps/random/rmgen/painter/SmoothingPainter.js @@ -28,10 +28,9 @@ SmoothingPainter.prototype.paint = function(area) for (let i = 0; i < this.iterations; ++i) { - const heightmap = clone(g_Map.height); - // Additional complexity to process all 4 vertices of each tile, i.e the last row too - const seen = new Array(heightmap.length).fill(0).map(zero => new Uint8Array(heightmap.length).fill(0)); + const vertexSize = g_Map.height.length; + const seen = new Array(vertexSize).fill(0).map(zero => new Uint8Array(vertexSize).fill(0)); for (const point of area.getPoints()) for (const tileVertex of g_TileVertices)