From 593e38ba45fc7d28e28bdcc0fa8020a6c62deac0 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 25 Nov 2026 17:24:57 +0400 Subject: 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. --- crates/fparkan-runtime/src/clan_script_init.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'crates/fparkan-runtime/src/clan_script_init.rs') 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 { 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); } -- cgit v1.2.3