feat(citygen): City::validate and seed sweep tests

Also guarantees one building per district and repairs interiors split
by crossing partitions, both found by the new validation.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Jeffrey Wilcke
2026-10-12 17:21:08 +02:00
parent b781e60d73
commit 9ac713bbe9
5 changed files with 373 additions and 4 deletions

View File

@@ -103,8 +103,10 @@ impl LotsStage {
});
continue;
}
// A district's first lot is always a building, so no district ends up empty.
let has_building = ctx.city.buildings.iter().any(|b| b.district == district.id);
let plaza_p = spec.plaza * (1.3 - density);
if chance(rng, plaza_p) {
if has_building && chance(rng, plaza_p) {
let parking = matches!(
district.theme,
crate::world::Theme::CorpCore | crate::world::Theme::Industrial