When smoothing walls, connect to doors and fgates

develop
myk002 2022-09-07 10:10:44 -07:00
parent 3cb890ee2a
commit 86e1a8d59c
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
2 changed files with 16 additions and 11 deletions

@ -43,6 +43,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `tags`: new built-in command to list the tool category tags and their definitions. tags associated with each tool are visible in the tool help and in the output of `ls`.
## Fixes
- `dig-now`: Fix direction of smoothed walls when adjacent to a door or floodgate
- ``job.removeJob()``: ensure jobs are removed from the world list when they are canceled
- `quickfort`: `Dreamfort <quickfort-blueprint-guide>` blueprint set: declare the hospital zone before building the coffer; otherwise DF fails to stock the hospital with materials

@ -424,26 +424,30 @@ static bool is_smooth_wall(MapExtras::MapCache &map, const DFCoord &pos) {
&& tileShape(tt) == df::tiletype_shape::WALL;
}
static bool is_smooth_wall_or_door(MapExtras::MapCache &map,
const DFCoord &pos) {
if (is_smooth_wall(map, pos))
return true;
static bool is_connector(MapExtras::MapCache &map, const DFCoord &pos) {
df::building *bld = Buildings::findAtTile(pos);
return bld && bld->getType() == df::building_type::Door;
return bld &&
(bld->getType() == df::building_type::Door ||
bld->getType() == df::building_type::Floodgate);
}
static bool is_smooth_wall_or_connector(MapExtras::MapCache &map,
const DFCoord &pos) {
return is_smooth_wall(map, pos) || is_connector(map, pos);
}
// adds adjacent smooth walls and doors to the given tdir
static TileDirection get_adjacent_smooth_walls(MapExtras::MapCache &map,
const DFCoord &pos,
TileDirection tdir) {
if (is_smooth_wall_or_door(map, DFCoord(pos.x, pos.y-1, pos.z)))
if (is_smooth_wall_or_connector(map, DFCoord(pos.x, pos.y-1, pos.z)))
tdir.north = 1;
if (is_smooth_wall_or_door(map, DFCoord(pos.x, pos.y+1, pos.z)))
if (is_smooth_wall_or_connector(map, DFCoord(pos.x, pos.y+1, pos.z)))
tdir.south = 1;
if (is_smooth_wall_or_door(map, DFCoord(pos.x-1, pos.y, pos.z)))
if (is_smooth_wall_or_connector(map, DFCoord(pos.x-1, pos.y, pos.z)))
tdir.west = 1;
if (is_smooth_wall_or_door(map, DFCoord(pos.x+1, pos.y, pos.z)))
if (is_smooth_wall_or_connector(map, DFCoord(pos.x+1, pos.y, pos.z)))
tdir.east = 1;
return tdir;
}
@ -469,7 +473,7 @@ static bool adjust_smooth_wall_dir(MapExtras::MapCache &map,
const DFCoord &pos,
TileDirection tdir = BLANK_TILE_DIRECTION) {
if (!is_smooth_wall(map, pos))
return false;
return is_connector(map, pos);
tdir = ensure_valid_tdir(get_adjacent_smooth_walls(map, pos, tdir));