From 694432dcf403ce0646091c55aaa614e890870250 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 6 Sep 2024 13:27:21 -0700 Subject: [PATCH] fix overcounting of total tiles when there are invalid tiles --- internal/quickfort/building.lua | 2 +- internal/quickfort/preview.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/quickfort/building.lua b/internal/quickfort/building.lua index 9f258c7e77..147442a656 100644 --- a/internal/quickfort/building.lua +++ b/internal/quickfort/building.lua @@ -532,7 +532,7 @@ function check_tiles_and_extents(ctx, buildings) -- as invalid; the building can still build around it owns_preview = quickfort_preview.set_preview_tile(ctx, pos, - is_valid_tile or db_entry.has_extents) + is_valid_tile or db_entry.has_extents or false) if not is_valid_tile then log('tile not usable: (%d, %d, %d)', pos.x, pos.y, pos.z) col[extent_y] = false diff --git a/internal/quickfort/preview.lua b/internal/quickfort/preview.lua index ea98b9de76..a1a7afd5f2 100644 --- a/internal/quickfort/preview.lua +++ b/internal/quickfort/preview.lua @@ -11,7 +11,7 @@ end function set_preview_tile(ctx, pos, is_valid_tile, override) local preview = ctx.preview if not preview then return false end - local preview_row = ensure_key(ensure_key(ctx.preview.tiles, pos.z), pos.y) + local preview_row = ensure_keys(ctx.preview.tiles, pos.z, pos.y) if preview_row[pos.x] == nil then preview.total_tiles = preview.total_tiles + 1 end