Skip to content

Commit

Permalink
Merge pull request #4911 from myk002/myk_pathable
Browse files Browse the repository at this point in the history
[pathable] fix wagon pathability calculation for stairs and doors
  • Loading branch information
myk002 authored Sep 4, 2024
2 parents 3fed2b1 + 19188cd commit a7115e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Template for new versions:
- `regrass`: no longer add all compatible grass types when using ``--force`` without ``--new``
- `regrass`: ``--mud`` now converts muddy slade to grass, consistent with normal DF behavior
- `gui/pathable`: fix hang when showing trade depot wagon access and a trade depot is submerged under water
- `gui/pathable`: fix incorrect calculation of wagon paths over stairs and through doors

## Misc Improvements
- `sort`: can now search for stockpiles on the Places>Stockpile tab by name, number, or enabled item categories
Expand Down
12 changes: 8 additions & 4 deletions plugins/pathable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,22 @@ struct FloodCtx {

static bool is_wagon_traversible(FloodCtx & ctx, const df::coord & pos, const df::coord & prev_pos) {
if (auto bld = Buildings::findAtTile(pos)) {
if (bld->getType() == df::building_type::Trap)
auto btype = bld->getType();
if (btype == df::building_type::Trap || btype == df::building_type::Door)
return false;
}

if (ctx.wgroup == Maps::getWalkableGroup(pos))
return true;

auto tt = Maps::getTileType(pos);
if (!tt)
return false;

auto shape = tileShape(*tt);
if (shape == df::tiletype_shape::STAIR_UP || shape == df::tiletype_shape::STAIR_UPDOWN)
return false;

if (ctx.wgroup == Maps::getWalkableGroup(pos))
return true;

if (shape == df::tiletype_shape::RAMP_TOP ) {
df::coord pos_below = pos + df::coord(0, 0, -1);
if (Maps::getWalkableGroup(pos_below)) {
Expand Down

0 comments on commit a7115e2

Please sign in to comment.