diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-26 11:36:35 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-26 11:36:35 +0300 |
| commit | f707bc6179521d316a93dde9beca2668115ad6cd (patch) | |
| tree | 125422ef403850a1d65527885d7755398413846c /crates/fparkan-runtime/src/clan_minds.rs | |
| parent | dfbdef7d4d1d295ee962dd8aab754ce6be902f8d (diff) | |
| download | fparkan-f707bc6179521d316a93dde9beca2668115ad6cd.tar.xz fparkan-f707bc6179521d316a93dde9beca2668115ad6cd.zip | |
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.
Diffstat (limited to 'crates/fparkan-runtime/src/clan_minds.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/clan_minds.rs | 45 |
1 files changed, 17 insertions, 28 deletions
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 |
