Combat fixes: exact-ray answers tied to their segment and block (#73), no fuse kill through a wall while waiting (#74), seeker needs confirmed sight and stops reading true velocity (#75), combat RNG and ids independent of graphics (#85), saved layouts validated whole before the scene is touched, refused autosave kept (#86)
build / mod (push) Successful in 3m48s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-30 14:57:19 +03:00
parent 2eb6763d03
commit b43d471706
8 changed files with 695 additions and 124 deletions
+21
View File
@@ -113,6 +113,27 @@ impl WaveConfig {
let aim = Aim::ALL.iter().position(|a| *a == self.aim).unwrap_or(0);
format!("{} {approach} {} {aim} {}", counts.join(","), self.dist, self.preset)
}
/// Whether `w` are words `parse` would read whole: an error says which is wrong (#86).
pub fn check(&self, w: &[&str]) -> Result<(), String> {
if let Some(c) = w.first() {
if c.split(',').take(KINDS.len()).any(|v| v.parse::<u32>().is_err()) {
return Err(format!("число по типам: «{c}»"));
}
}
if w.get(1).is_some_and(|v| v.parse::<usize>().ok().is_none_or(|i| i >= Approach::ALL.len())) {
return Err(format!("подход: «{}»", w[1]));
}
if w.get(2).is_some_and(|v| v.parse::<f64>().ok().is_none_or(|d| !d.is_finite())) {
return Err(format!("дальность: «{}»", w[2]));
}
if w.get(3).is_some_and(|v| v.parse::<usize>().ok().is_none_or(|i| i >= Aim::ALL.len())) {
return Err(format!("цель налёта: «{}»", w[3]));
}
if w.get(4).is_some_and(|v| v.parse::<usize>().is_err()) {
return Err(format!("набор: «{}»", w[4]));
}
Ok(())
}
/// Reads `text`'s words; what does not parse keeps its value.
pub fn parse(&mut self, w: &[&str]) {
if let Some(c) = w.first() {