Title demo: the knights come from a forest above ground; lighter meadow, darker trees, no lava above ground

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-05 23:09:49 +01:00
1 parent d54de78f37
commit 7da61d3d50
4 files changed
+88 -7

No files matched your search

+26
View File
@@ -64,6 +64,14 @@ impl Game {
continue;
}
self.map.set_sky(i, true);
// no lava under the open sky: rivers up here carry water
let tl = &mut self.map.t[i];
match tl.kind {
Kind::Lava | Kind::Obsidian => tl.kind = Kind::Water,
Kind::LavaBridge => tl.kind = Kind::Bridge,
Kind::Drawbridge => tl.res &= !DB_LAVA,
_ => {}
}
if keep {
continue;
}
@@ -195,4 +203,22 @@ mod tests {
// the heroes find their way from the gate to the core
assert!(g.map.hero_path_to_core(idx(gx + 1, gy + 1)).is_some());
}
#[test]
fn no_lava_under_the_open_sky() {
let mut g = Game::new(31, 128, 96);
// a lava river across the whole map
for x in 2..126 {
for y in 40..44 {
g.map.t[idx(x, y)].kind = Kind::Lava;
}
}
g.add_surface(31, 0.5, 3);
for i in 0..g.map.t.len() {
if g.map.sky(i) {
assert!(!matches!(g.map.t[i].kind, Kind::Lava | Kind::LavaBridge), "lava above ground");
}
}
assert!(g.map.t.iter().any(|t| t.kind == Kind::Lava), "the lava below stays");
}
}