From 6dd7928765e16ac0fc5104db058806ba4fffba8a Mon Sep 17 00:00:00 2001 From: John Fisher Date: Fri, 23 Aug 2024 15:13:25 -0400 Subject: [PATCH 1/3] [gui/design] Update Line & Freeform tools to not overcount tiles --- internal/design/shapes.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/design/shapes.lua b/internal/design/shapes.lua index 6db26c527b..0007dece39 100644 --- a/internal/design/shapes.lua +++ b/internal/design/shapes.lua @@ -445,8 +445,10 @@ function Line:plot_bresenham(x0, y0, x1, y1, thickness) while true do for j = -math.floor(thickness / 2), math.ceil(thickness / 2) - 1 do if not self.arr[x + j] then self.arr[x + j] = {} end - self.arr[x + j][y] = true - self.num_tiles = self.num_tiles + 1 + if not self.arr[x + j][y] then + self.arr[x + j][y] = true + self.num_tiles = self.num_tiles + 1 + end end if x == x1 and y == y1 + i then @@ -641,8 +643,10 @@ function FreeForm:update(points, extra_points) for x, y_row in pairs(line_class.arr) do for y, _ in pairs(y_row) do if not self.arr[x] then self.arr[x] = {} end - self.arr[x][y] = true - self.num_tiles = self.num_tiles + 1 + if not self.arr[x][y] then + self.arr[x][y] = true + self.num_tiles = self.num_tiles + 1 + end end end end From 68d0aeac12fad17dd5d1db38eef8756925db9319 Mon Sep 17 00:00:00 2001 From: John Fisher Date: Fri, 23 Aug 2024 15:26:57 -0400 Subject: [PATCH 2/3] fix whitespace --- internal/design/shapes.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/design/shapes.lua b/internal/design/shapes.lua index 0007dece39..5199aa1d10 100644 --- a/internal/design/shapes.lua +++ b/internal/design/shapes.lua @@ -643,7 +643,7 @@ function FreeForm:update(points, extra_points) for x, y_row in pairs(line_class.arr) do for y, _ in pairs(y_row) do if not self.arr[x] then self.arr[x] = {} end - if not self.arr[x][y] then + if not self.arr[x][y] then self.arr[x][y] = true self.num_tiles = self.num_tiles + 1 end From 3c6befdee4329738728ae062e81baa2154936533 Mon Sep 17 00:00:00 2001 From: John Fisher Date: Fri, 23 Aug 2024 17:18:34 -0400 Subject: [PATCH 3/3] Update changelog.txt --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index de4595e256..1c305263a5 100644 --- a/changelog.txt +++ b/changelog.txt @@ -39,6 +39,7 @@ Template for new versions: ## Fixes - `timestream`: ensure child growth events (e.g. becoming an adult) are not skipped over - `empty-bin`: ``--liquids`` option correctly emptying containers filled with LIQUID_MISC +- `gui/design`: Update Line & Freeform tools to not overcount tiles ## Misc Improvements - `gui/sitemap`: show whether a unit is friendly, hostile, or wildlife