Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Template for new versions:
- `buildingplan`: fix "Unlink all" only unlinking some mechanisms (or crashing) when freeing mechanisms from the building
- `burrow`: fix ``tiles clear`` and other tile operations silently failing because burrow block z-coordinates were stored incorrectly in the ``Burrows`` module
- `dfhack-run`: on Windows, no longer mutates, hides, and closes the console it inherits when run from an existing terminal (issue #3827)
- `dig-now`: update light/outside flags of tiles below tiles that are dug into solid rather than open tiles
- `export-world-map`: fix crash exporting site data for a site whose owner has an undefined race
- `gui/quickfort`: show smoothing designations immediately after applying a blueprint
- `overlay`: overlay hotkeys no longer steal typed characters while the game is capturing text input, e.g. when renaming a building
Expand Down
36 changes: 2 additions & 34 deletions plugins/dig-now.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,38 +209,6 @@ static const struct_field_info dig_now_options_fields[] = {
};
struct_identity dig_now_options::_identity(sizeof(dig_now_options), &df::allocator_fn<dig_now_options>, NULL, "dig_now_options", NULL, dig_now_options_fields);

// propagate light, outside, and subterranean flags to open tiles below this one
static void propagate_vertical_flags(MapExtras::MapCache &map,
const DFCoord &pos) {
df::tile_designation td = map.designationAt(pos);

if (!map.ensureBlockAt(DFCoord(pos.x, pos.y, pos.z+1))) {
// only the sky above
td.bits.light = true;
td.bits.outside = true;
td.bits.subterranean = false;
}

int32_t zlevel = pos.z;
df::tiletype_shape shape =
tileShape(map.tiletypeAt(DFCoord(pos.x, pos.y, zlevel)));
while ((shape == df::tiletype_shape::EMPTY
|| shape == df::tiletype_shape::RAMP_TOP)
&& map.ensureBlockAt(DFCoord(pos.x, pos.y, --zlevel))) {
DFCoord pos_below(pos.x, pos.y, zlevel);
df::tile_designation td_below = map.designationAt(pos_below);
if (td_below.bits.light == td.bits.light
&& td_below.bits.outside == td.bits.outside
&& td_below.bits.subterranean == td.bits.subterranean)
break;
td_below.bits.light = td.bits.light;
td_below.bits.outside = td.bits.outside;
td_below.bits.subterranean = td.bits.subterranean;
map.setDesignationAt(pos_below, td_below);
shape = tileShape(map.tiletypeAt(pos_below));
}
}

static bool can_dig_default(df::tiletype tt) {
df::tiletype_shape shape = tileShape(tt);
return shape == df::tiletype_shape::WALL ||
Expand Down Expand Up @@ -496,7 +464,7 @@ static bool dig_tile(color_ostream &out, MapExtras::MapCache &map,
dig_tile(out, map, pos_below, td_below, dug_tiles);
}
clean_ramps(map, pos);
propagate_vertical_flags(map, pos);
map.propagateVerticalFlags(pos);
return true;
}
} else {
Expand Down Expand Up @@ -539,7 +507,7 @@ static bool dig_tile(color_ostream &out, MapExtras::MapCache &map,
map.setTiletypeAt(pos_above,
get_target_type(tt, df::tiletype_shape::RAMP_TOP));
remove_ramp_top(map, DFCoord(pos.x, pos.y, pos.z+2));
propagate_vertical_flags(map, DFCoord(pos.x, pos.y, pos.z + 1));
map.propagateVerticalFlags(DFCoord(pos.x, pos.y, pos.z + 1));
}
}
break;
Expand Down
Loading