From 14b50356ff4fc61d7bee4b509053c7fc369a65da Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Mon, 24 Jun 2024 12:00:02 -0400 Subject: [PATCH] Fix: auxStructureNonblocking() for script-queued object removal Where the script immediately replaced the old struct --- src/structure.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/structure.cpp b/src/structure.cpp index 53d97df481c..f9b44d16ee6 100644 --- a/src/structure.cpp +++ b/src/structure.cpp @@ -167,7 +167,18 @@ static void auxStructureNonblocking(STRUCTURE *psStructure) { for (int j = 0; j < b.size.y; j++) { - auxClearAll(b.map.x + i, b.map.y + j, AUXBITS_BLOCKING | AUXBITS_OUR_BUILDING | AUXBITS_NONPASSABLE); + int x = b.map.x + i; + int y = b.map.y + j; + MAPTILE *psTile = mapTile(x, y); + if (psTile->psObject == psStructure) + { + auxClearAll(x, y, AUXBITS_BLOCKING | AUXBITS_OUR_BUILDING | AUXBITS_NONPASSABLE); + } + else + { + // Likely a script-queued object removal for a position where the script immediately replaced the old struct - just log + debug(LOG_WZ, "Skipping blocking bit clear - structure %" PRIu32 " is not the recorded tile object at (%d, %d)", psStructure->id, x, y); + } } } }