From 3c8a174a68dfae223c68bd0843db0a8544bef585 Mon Sep 17 00:00:00 2001 From: myk002 Date: Sat, 17 Jul 2021 11:45:16 -0700 Subject: [PATCH] use pillars for wall ends instead of NS or EW --- plugins/dig-now.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/plugins/dig-now.cpp b/plugins/dig-now.cpp index c4ed9acbd..678490b45 100644 --- a/plugins/dig-now.cpp +++ b/plugins/dig-now.cpp @@ -436,15 +436,18 @@ static TileDirection get_adjacent_smooth_walls(MapExtras::MapCache &map, return tdir; } -// ensure we have at least two directions enabled so we can find a matching -// tiletype +// ensure we have at least two directions enabled (or 0) so we can find a +// matching tiletype. The game chooses to curve "end piece" walls into +// orthogonally adjacent hidden tiles, or uses a pillar if there are no such +// tiles. we take the easier, but not quite conformant, path here and always use +// a pillar for end pieces. If we want to become faithful to how the game does +// it, this code should be moved to the post-processing phase after hidden tiles +// have been revealed. We would also have to scan for wall ends that are no +// longer adjacent to hidden tiles and convert them to pillars when we dig two +// tiles away from such a wall end and reveal their adjacent hidden tile. static TileDirection ensure_valid_tdir(TileDirection tdir) { - if (tdir.sum() < 2) { - if (tdir.north) tdir.south = 1; - else if (tdir.south) tdir.north = 1; - else if (tdir.east) tdir.west = 1; - else if (tdir.west) tdir.east = 1; - } + if (tdir.sum() < 2) + tdir.whole = 0; return tdir; }