ensure soil tiles get randomized variants

develop
myk002 2021-08-01 23:29:32 -07:00
parent 98fd6effdc
commit d8b5ac41d9
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 8 additions and 10 deletions

@ -178,23 +178,21 @@ static void dig_type(MapExtras::MapCache &map, const DFCoord &pos,
if (!blk) if (!blk)
return; return;
// ensure we run this even if one of the later steps fails (e.g. OpenSpace)
map.setTiletypeAt(pos, tt); map.setTiletypeAt(pos, tt);
// digging a tile reverts it to the layer soil/stone material // digging a tile should revert it to the layer soil/stone material
if (!blk->setStoneAt(pos, tt, map.layerMaterialAt(pos)) && if (!blk->setStoneAt(pos, tt, map.layerMaterialAt(pos)))
!blk->setSoilAt(pos, tt, map.layerMaterialAt(pos))) blk->setSoilAt(pos, tt, map.layerMaterialAt(pos));
return; }
static df::tiletype get_target_type(df::tiletype tt, df::tiletype_shape shape) {
tt = findSimilarTileType(tt, shape);
// un-smooth dug tiles // un-smooth dug tiles
tt = map.tiletypeAt(pos);
tt = findTileType(tileShape(tt), tileMaterial(tt), tileVariant(tt), tt = findTileType(tileShape(tt), tileMaterial(tt), tileVariant(tt),
df::tiletype_special::NORMAL, tileDirection(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(tt);
return findRandomVariant(findSimilarTileType(tt, shape));
} }
static void dig_shape(MapExtras::MapCache &map, const DFCoord &pos, static void dig_shape(MapExtras::MapCache &map, const DFCoord &pos,