diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-25 16:24:57 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-25 16:24:57 +0300 |
| commit | 593e38ba45fc7d28e28bdcc0fa8020a6c62deac0 (patch) | |
| tree | 6fbc4f65e64580793d94268a1c32b449ff7e2fcf /crates/fparkan-runtime/src/clan_script_init.rs | |
| parent | a4a9b7a6478c9c1efcf0aef8b37464dc0e5b339e (diff) | |
| download | fparkan-593e38ba45fc7d28e28bdcc0fa8020a6c62deac0.tar.xz fparkan-593e38ba45fc7d28e28bdcc0fa8020a6c62deac0.zip | |
feat(ai): load clan research candidates during Init
Handle the no-result Handler(43) by loading direct AI DAT candidates and
running the recovered selector against the clan's TRF. Keep the catalog and
its context alive per clan. Share catalog enumeration with transport selection.
Match the stock NTFS name order, including underscore placement. A fresh
Single.02 run of the original supplied 77 ordered entries, status bytes and
selected index 60 (swelbld1.dat); the licensed regression matches that state.
Both captured and installed ai.dll match the documented GOG SHA-256.
Keep paid laboratory work, extended candidate metadata and Handler(69)
explicitly stubbed. The report exposes loaded catalogs separately from those
remaining gaps. A loading failure retains an indexed Init stub.
Validate workspace fmt/check/tests, licensed live-catalog comparison, all
29 stock missions at 900 seconds without stops or Handler(43) load failures,
and mission 29 in a Vulkan-validation window.
Diffstat (limited to 'crates/fparkan-runtime/src/clan_script_init.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/clan_script_init.rs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/crates/fparkan-runtime/src/clan_script_init.rs b/crates/fparkan-runtime/src/clan_script_init.rs index 860f7ed0..7296ff2b 100644 --- a/crates/fparkan-runtime/src/clan_script_init.rs +++ b/crates/fparkan-runtime/src/clan_script_init.rs @@ -4,6 +4,10 @@ use fparkan_script::{ }; pub(super) enum InitOrder { + ResearchCatalog { + clan: usize, + instruction_index: usize, + }, BaseRadius { clan: usize, limit: f32, @@ -17,6 +21,13 @@ pub(super) enum InitOrder { }, } +pub(super) fn research_catalog(instruction: &ScriptInstruction) -> bool { + matches!( + (instruction.header_words, instruction.references.as_slice()), + ([43, u32::MAX, u32::MAX, u32::MAX, 6, 0, u32::MAX], []) + ) +} + pub(super) fn base_radius( instruction: &ScriptInstruction, values: &[VarSetDefault], @@ -69,8 +80,6 @@ pub(super) fn stubbed_handler( declarations: &VarSet, ) -> Option<u8> { match (instruction.header_words, instruction.references.as_slice()) { - // shortcut: resume Init until the live research context is wired. - ([43, u32::MAX, u32::MAX, u32::MAX, 6, 0, u32::MAX], []) => Some(43), // shortcut: resume Init until the AI consumer of this setting is wired. ([69, u32::MAX, u32::MAX, u32::MAX, 6, 1, u32::MAX], [index]) if matches!(values.get(*index as usize), Some(VarSetDefault::Dword(_))) => @@ -97,14 +106,16 @@ mod tests { use super::*; #[test] - fn only_the_no_result_research_refresh_is_stubbed() { + fn research_catalog_requires_the_no_result_refresh_form() { let mut instruction = ScriptInstruction { header_words: [43, u32::MAX, u32::MAX, u32::MAX, 6, 0, u32::MAX], references: Vec::new(), }; let declarations = fparkan_script::parse_varset(b"").unwrap(); - assert_eq!(stubbed_handler(&instruction, &[], &declarations), Some(43)); + assert!(research_catalog(&instruction)); + assert_eq!(stubbed_handler(&instruction, &[], &declarations), None); instruction.header_words[1] = 0; + assert!(!research_catalog(&instruction)); assert_eq!(stubbed_handler(&instruction, &[], &declarations), None); } |
