Skip to content

Units::teleport: update occupancy for the full EQUIPMENT footprint - #5924

Open
Alistair-Afton wants to merge 1 commit into
DFHack:developfrom
Alistair-Afton:fix-teleport-wagon-occupancy
Open

Alistair-Afton wants to merge 1 commit into
DFHack:developfrom
Alistair-Afton:fix-teleport-wagon-occupancy

Conversation

@Alistair-Afton

Copy link
Copy Markdown
Contributor

Fixes #5797

Summary

Units::teleport only cleared and set the unit/unit_grounded occupancy bits on the unit's center tile. EQUIPMENT units such as wagons occupy a 3x3 footprint centered on their position, so a teleported wagon left stale flags on the eight surrounding source tiles and arrived with none set on the destination footprint.

The footprint extent is now derived from the race's EQUIPMENT_WAGON flag; ordinary units keep the existing single-tile behavior. The per-tile update logic is otherwise unchanged.

Testing

Verified in a live fort against the rebuilt install by driving a synthetic wagon unit (race EQUIPMENT_WAGON) through dfhack.units.teleport and reading map_block.occupancy directly:

  • Teleport A->B: all 9 source tiles cleared, all 9 destination tiles set. Previously only the center tile was updated in both directions.
  • Regression check with a real dwarf: only the single position tile is cleared/set, unchanged from before.

EQUIPMENT units (wagons) occupy a 3x3 footprint centered on their
position, but teleport only cleared and set the unit occupancy bits on
the center tile. Teleported wagons left stale unit flags on the eight
surrounding source tiles and arrived with none set on the destination
footprint, leaving the map occupancy inconsistent until something
recomputed it (issue DFHack#5797).

The footprint extent now comes from the race's EQUIPMENT_WAGON flag, so
ordinary units keep the existing single-tile behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Units::teleport does not correctly handle Wagons

1 participant