From 1641360da9df80faa7ef3748ce8cde5ef834c7a7 Mon Sep 17 00:00:00 2001 From: Grimsace Date: Thu, 5 Feb 2026 20:12:21 -0600 Subject: [PATCH] fixed an off by 1 threading problem --- terrain.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/terrain.go b/terrain.go index 3d2e9ad..42dea6a 100644 --- a/terrain.go +++ b/terrain.go @@ -187,8 +187,8 @@ func GenerateTrees(img *image.RGBA, lakePixels, roadPixels, buildingPixels []ima noise := opensimplex.New(seed) treeNoiseMap := image.NewGray(image.Rect(0, 0, width, height)) treeNoiseZoom := 0.05 - for y := range height { - for x := range width { + for y := 0; y < height; y++ { + for x := 0; x < width; x++ { val := noise.Eval2(float64(x)*treeNoiseZoom, float64(y)*treeNoiseZoom) val = (val + 1) / 2 // Normalize to 0-1 treeNoiseMap.SetGray(x, y, color.Gray{Y: uint8(val * 255)}) @@ -250,6 +250,9 @@ func GenerateTrees(img *image.RGBA, lakePixels, roadPixels, buildingPixels []ima for i := 0; i < numGoroutines; i++ { start := i * pointsPerGoroutine + if start >= len(allPoints) { + break + } end := start + pointsPerGoroutine if end > len(allPoints) { end = len(allPoints)