diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 94bfad310..c305de56c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,11 +20,11 @@ repos: args: ['--fix=lf'] - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.21.0 + rev: 0.22.0 hooks: - id: check-github-workflows - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.4.2 + rev: v1.5.1 hooks: - id: forbid-tabs exclude_types: diff --git a/docs/changelog.txt b/docs/changelog.txt index 15a30b9e2..a8375f4b5 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -39,6 +39,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - `hotkeys`: hotkey hints on menu popup will no longer get their last character cut off by the scrollbar - ``launchdf``: launch Dwarf Fortress via the Steam client so Steam Workshop is functional - `blueprint`: interpret saplings, shrubs, and twigs as floors instead of walls +- `combine`: fix error processing stockpiles with boundaries that extend outside of the map ## Misc Improvements - `buildingplan`: items in the item selection dialog should now use the same item quality symbols as the base game diff --git a/library/modules/Buildings.cpp b/library/modules/Buildings.cpp index de87d3fb8..7694a696b 100644 --- a/library/modules/Buildings.cpp +++ b/library/modules/Buildings.cpp @@ -1645,19 +1645,25 @@ StockpileIterator& StockpileIterator::operator++() { if (block) { // Check the next item in the current block. ++current; + } + else if (stockpile->x2 < 0 || stockpile->y2 < 0 || stockpile->z < 0 || stockpile->x1 > world->map.x_count - 1 || stockpile->y1 > world->map.y_count - 1 || stockpile->z > world->map.z_count - 1) { + // if the stockpile bounds exist outside of valid map plane then no items can be in the stockpile + block = NULL; + item = NULL; + return *this; } else { // Start with the top-left block covering the stockpile. - block = Maps::getTileBlock(stockpile->x1, stockpile->y1, stockpile->z); + block = Maps::getTileBlock(std::min(std::max(stockpile->x1, 0), world->map.x_count-1), std::min(std::max(stockpile->y1, 0), world->map.y_count-1), stockpile->z); current = 0; } while (current >= block->items.size()) { // Out of items in this block; find the next block to search. - if (block->map_pos.x + 16 <= stockpile->x2) { + if (block->map_pos.x + 16 <= std::min(stockpile->x2, world->map.x_count-1)) { block = Maps::getTileBlock(block->map_pos.x + 16, block->map_pos.y, stockpile->z); current = 0; - } else if (block->map_pos.y + 16 <= stockpile->y2) { - block = Maps::getTileBlock(stockpile->x1, block->map_pos.y + 16, stockpile->z); + } else if (block->map_pos.y + 16 <= std::min(stockpile->y2, world->map.y_count-1)) { + block = Maps::getTileBlock(std::max(stockpile->x1, 0), block->map_pos.y + 16, stockpile->z); current = 0; } else { // All items in all blocks have been checked. diff --git a/library/xml b/library/xml index 739d17867..d7f07e54b 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 739d1786723bbe912f448064c5705092a7936cc6 +Subproject commit d7f07e54b4ea7832b226f8d8678906c9c366918a diff --git a/scripts b/scripts index d2dad272e..53f0aedf9 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit d2dad272e4b24c043ca62f843511c763fb1f67b5 +Subproject commit 53f0aedf9f7df33a4f79246ba46de02794619d09