From f707bc6179521d316a93dde9beca2668115ad6cd Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Nov 2026 12:36:35 +0400 Subject: fix(factory): rank researched combat designs for clan orders Use the clan technology table to qualify candidates for SELECT_STRONGEST, then compare their projected Control endurance and weapon banks. The stock Two Fortresses factory releases 12spd1.dat in about ten seconds. Checked the selector with the original DLL, the first release and reservation in licensed tests, and the new model in the game window. --- crates/fparkan-runtime/src/clan_minds.rs | 45 ++++++++++++-------------------- 1 file changed, 17 insertions(+), 28 deletions(-) (limited to 'crates/fparkan-runtime/src/clan_minds.rs') diff --git a/crates/fparkan-runtime/src/clan_minds.rs b/crates/fparkan-runtime/src/clan_minds.rs index 0f14f0a4..1a216b7d 100644 --- a/crates/fparkan-runtime/src/clan_minds.rs +++ b/crates/fparkan-runtime/src/clan_minds.rs @@ -103,41 +103,30 @@ mod tests { .reserved_minds(&engine.world, owner), ) }; - assert_eq!(available(&engine, OwnerId(0)), 3); - assert_eq!(available(&engine, OwnerId(1)), 4); - frame(&mut engine, 0).unwrap(); - assert_eq!( + let reserved = |engine: &crate::Engine| { engine .production .as_ref() .unwrap() - .reserved_minds(&engine.world, OwnerId(1)), - 1 - ); + .reserved_minds(&engine.world, OwnerId(1)) + }; + assert_eq!(available(&engine, OwnerId(0)), 3); + assert_eq!(available(&engine, OwnerId(1)), 4); + frame(&mut engine, 0).unwrap(); + assert_eq!(reserved(&engine), 1); assert_eq!(available(&engine, OwnerId(1)), 3); - for now_ms in (100..=20_000).step_by(100) { - frame(&mut engine, now_ms).unwrap(); - } - assert_eq!( - engine - .production - .as_ref() - .unwrap() - .reserved_minds(&engine.world, OwnerId(1)), - 0 - ); + let first_release = (100..=22_000) + .step_by(100) + .find(|&now_ms| { + frame(&mut engine, now_ms).unwrap(); + reserved(&engine) == 0 + }) + .expect("the first build converted its reservation into a robot"); assert_eq!(available(&engine, OwnerId(1)), 3); - for now_ms in (20_100..=28_000).step_by(100) { + assert!(((first_release + 100)..=32_000).step_by(100).any(|now_ms| { frame(&mut engine, now_ms).unwrap(); - } - assert_eq!( - engine - .production - .as_ref() - .unwrap() - .reserved_minds(&engine.world, OwnerId(1)), - 1 - ); + reserved(&engine) == 1 + })); assert_eq!(available(&engine, OwnerId(1)), 2); let loaded = engine.loaded.as_ref().unwrap(); let plant = loaded -- cgit v1.2.3