no dungeons = no dungeons with caves!

This commit is contained in:
Maxicarlos08 2023-06-18 17:49:53 +02:00
parent 38c986fa59
commit 73a79b32a1
No known key found for this signature in database
2 changed files with 16 additions and 2 deletions

View File

@ -4,6 +4,7 @@ mod econ;
use crate::{
config::CONFIG,
layer::cave,
sim::WorldSim,
site::{namegen::NameGen, Castle, Settlement, Site as WorldSite, Tree},
site2,
@ -1879,7 +1880,20 @@ impl SiteKind {
}
true
},
SiteKind::Dungeon => on_land(),
SiteKind::Dungeon => {
on_land() && {
let land = Land::from_sim(sim);
let loc = loc.map(|v| TerrainChunkSize::RECT_SIZE.y as i32 * v);
// Get shallow caves under the dungeon
let mut tunnels =
cave::tunnels_at(loc /* very surely wrong */, 1, &land)
.chain(cave::tunnels_at(loc, 2, &land));
// Make sure there are no shallow caves near the dungeon
tunnels.next().is_none()
}
},
SiteKind::Refactor | SiteKind::Settlement => suitable_for_town(),
SiteKind::Bridge(_, _) => true,
}

View File

@ -217,7 +217,7 @@ impl Tunnel {
}
}
fn tunnels_at<'a>(
pub(crate) fn tunnels_at<'a>(
wpos: Vec2<i32>,
level: u32,
land: &'a Land,