Skip to content

Units::teleport does not correctly handle Wagons #5797

Closed

Description

@quietust

The gui/teleport script uses the Units::teleport(df::unit *, df::coord) function to move units, and it appears to be capable of teleporting caravan wagons. However, it does not have the necessary logic to adjust occupancy flags for EQUIPMENT creatures, which means it will leave the map's occupancy flags in an inconsistent state afterwards.

DF's own functions unitst::do_largeocc() and unitst::undo_largeocc() are responsible for handling this.

Activity

  1. Alistair-Afton commented on Sep 16, 2026

    @Alistair-Afton
    Contributor

    Confirmed. Units::teleport only updates the unit/unit_grounded occupancy bits on the single center tile, so EQUIPMENT-sized units like wagons leave stale flags on the other tiles of their footprint and arrive with none set.

    unitst::do_largeocc/undo_largeocc are not mapped in df-structures yet, so the fix either needs those added to symbols, or teleport needs to replicate the footprint update itself (which we would want to verify against a live wagon, since the footprint logic lives in those functions).

  2. Alistair-Afton commented on Sep 16, 2026

    @Alistair-Afton
    Contributor

    Fix in #5924. Rather than mapping do_largeocc/undo_largeocc (which would need per-platform symbol work), teleport now derives the footprint extent from the race's EQUIPMENT_WAGON flag and applies the same occupancy update across all 9 tiles. Verified live: all source tiles clear and all destination tiles set on teleport, and ordinary units keep single-tile behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions