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/lib.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/lib.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/lib.rs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs index 10e8e2a0..1b80a8ac 100644 --- a/crates/fparkan-runtime/src/lib.rs +++ b/crates/fparkan-runtime/src/lib.rs @@ -53,6 +53,7 @@ mod clan_combat_groups; mod clan_combat_strength; mod clan_mining; mod clan_problem_conditions; +mod clan_research; mod clan_script_init; mod clan_targeting; mod clan_transport_schemes; @@ -2564,6 +2565,17 @@ fn load_mission_with_options( let mut clan_ai_events = clan_ai_events::ClanAiEvents::default(); for order in init_orders { match order { + clan_script_init::InitOrder::ResearchCatalog { + clan, + instruction_index, + } => clan_research::initialize( + vfs.as_ref(), + &mission, + &mut clan_ai_events, + &mut loaded_scripts.bundles, + clan, + instruction_index, + ), clan_script_init::InitOrder::BaseRadius { clan, limit } => { clan_ai_events.set_base_radius(clan, limit); } @@ -2909,6 +2921,7 @@ pub struct SimulationReport { pub clan_ai_event_stops: Vec<(MissionEventStop, u64)>, /// Calls to stubbed research policy or status, grouped by clan and handler. pub clan_research_status_stubs: Vec<(usize, u8, u64)>, + pub clan_research_catalogs: Vec<(usize, usize, u32)>, /// Counts of pending script problems by clan and problem kind. pub clan_problem_dispatch_stubs: std::collections::BTreeMap<(usize, u32), u64>, /// Starts under the approximate scheduler, grouped by clan and problem kind. @@ -2980,6 +2993,7 @@ pub fn simulate_mission_report( mission_event_stops: Vec::new(), clan_ai_event_stops: Vec::new(), clan_research_status_stubs: Vec::new(), + clan_research_catalogs: Vec::new(), clan_problem_dispatch_stubs: Default::default(), clan_problem_starts: Vec::new(), script_factory_rejections: Vec::new(), @@ -3080,6 +3094,9 @@ pub fn simulate_mission_report( report .clan_research_status_stubs .extend(loaded.clan_ai_events.research_status_stubs()); + report + .clan_research_catalogs + .extend(loaded.clan_ai_events.research_catalogs()); for problem in loaded.clan_ai_events.pending_problems() { *report .clan_problem_dispatch_stubs @@ -8405,6 +8422,13 @@ fn resolve_init_states( init_orders.push(clan_script_init::InitOrder::BaseRadius { clan, limit }); return Some(None); } + if clan_script_init::research_catalog(instruction) { + init_orders.push(clan_script_init::InitOrder::ResearchCatalog { + clan, + instruction_index: index, + }); + return Some(None); + } if let Some(order) = clan_script_init::unit_order(&varset.declarations, instruction, values) { @@ -16388,7 +16412,7 @@ mod tests { &mut Vec::new(), ) .expect("partial Init keeps the prefix and continues with the next clan"); - assert_eq!(partial_bundles[0].init_stubs, vec![(1, 43)]); + assert!(partial_bundles[0].init_stubs.is_empty()); assert!(matches!( partial_bundles[0].init_execution, MissionScriptInitExecution::Unsupported { |
