From d8b5ac41d9b2b5e99bc2e1458b69f962b2704620 Mon Sep 17 00:00:00 2001 From: myk002 Date: Sun, 1 Aug 2021 23:29:32 -0700 Subject: [PATCH] ensure soil tiles get randomized variants --- plugins/dig-now.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/plugins/dig-now.cpp b/plugins/dig-now.cpp index 1c0e849d9..0abf935a4 100644 --- a/plugins/dig-now.cpp +++ b/plugins/dig-now.cpp @@ -178,23 +178,21 @@ static void dig_type(MapExtras::MapCache &map, const DFCoord &pos, if (!blk) return; - // ensure we run this even if one of the later steps fails (e.g. OpenSpace) map.setTiletypeAt(pos, tt); - // digging a tile reverts it to the layer soil/stone material - if (!blk->setStoneAt(pos, tt, map.layerMaterialAt(pos)) && - !blk->setSoilAt(pos, tt, map.layerMaterialAt(pos))) - return; + // digging a tile should revert it to the layer soil/stone material + if (!blk->setStoneAt(pos, tt, map.layerMaterialAt(pos))) + blk->setSoilAt(pos, tt, map.layerMaterialAt(pos)); +} + +static df::tiletype get_target_type(df::tiletype tt, df::tiletype_shape shape) { + tt = findSimilarTileType(tt, shape); // un-smooth dug tiles - tt = map.tiletypeAt(pos); tt = findTileType(tileShape(tt), tileMaterial(tt), tileVariant(tt), df::tiletype_special::NORMAL, tileDirection(tt)); - map.setTiletypeAt(pos, tt); -} -static df::tiletype get_target_type(df::tiletype tt, df::tiletype_shape shape) { - return findRandomVariant(findSimilarTileType(tt, shape)); + return findRandomVariant(tt); } static void dig_shape(MapExtras::MapCache &map, const DFCoord &pos,