diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-14 19:54:11 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-14 19:54:11 +0300 |
| commit | e5e9f2a8ddc41f0e1af0e1ada5c1da669d40ceb0 (patch) | |
| tree | db32a72378d7f2fc0d792366f6cd3a1fb3bc9253 /crates/fparkan-runtime/src/clan_script_init.rs | |
| parent | c38fb66d2b2dfed3a7eb748914a3e2d9f9871768 (diff) | |
| download | fparkan-e5e9f2a8ddc41f0e1af0e1ada5c1da669d40ceb0.tar.xz fparkan-e5e9f2a8ddc41f0e1af0e1ada5c1da669d40ceb0.zip | |
fix(script): report the uncovered generator search order
Recognize the stock generator search order as an explicit stub and continue immediately. Mission 13 now completes clan initialization; searching for and capturing a generator still needs the native task.
Diffstat (limited to 'crates/fparkan-runtime/src/clan_script_init.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/clan_script_init.rs | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/crates/fparkan-runtime/src/clan_script_init.rs b/crates/fparkan-runtime/src/clan_script_init.rs index ee205baa..fedc8ee9 100644 --- a/crates/fparkan-runtime/src/clan_script_init.rs +++ b/crates/fparkan-runtime/src/clan_script_init.rs @@ -67,6 +67,7 @@ pub(super) fn unit_order( pub(super) fn stubbed_handler( instruction: &ScriptInstruction, values: &[VarSetDefault], + declarations: &VarSet, ) -> Option<u8> { match (instruction.header_words, instruction.references.as_slice()) { // shortcut: resume Init until the live research context is wired. @@ -86,6 +87,17 @@ pub(super) fn stubbed_handler( { Some(69) } + // shortcut: resume Init until the search and capture task is wired. + ([15, u32::MAX, u32::MAX, u32::MAX, 6, 10, u32::MAX], _) => { + let order = declarations + .resolve_handler15_with_values(instruction, values) + .ok()?; + matches!( + (order.word_1, order.word_2, order.target), + (5, 3, Handler15TargetPayload::ByType(0x8000_0002)) + ) + .then_some(15) + } _ => None, } } @@ -100,9 +112,10 @@ mod tests { header_words: [43, u32::MAX, u32::MAX, u32::MAX, 6, 0, u32::MAX], references: Vec::new(), }; - assert_eq!(stubbed_handler(&instruction, &[]), Some(43)); + let declarations = fparkan_script::parse_varset(b"").unwrap(); + assert_eq!(stubbed_handler(&instruction, &[], &declarations), Some(43)); instruction.header_words[1] = 0; - assert_eq!(stubbed_handler(&instruction, &[]), None); + assert_eq!(stubbed_handler(&instruction, &[], &declarations), None); } #[test] @@ -112,13 +125,17 @@ mod tests { references: vec![0], }; let values = [VarSetDefault::FloatBits(500.0_f32.to_bits())]; - assert_eq!(stubbed_handler(&instruction, &values), Some(68)); + let declarations = fparkan_script::parse_varset(b"").unwrap(); + assert_eq!( + stubbed_handler(&instruction, &values, &declarations), + Some(68) + ); assert_eq!( - stubbed_handler(&instruction, &[VarSetDefault::Dword(500)]), + stubbed_handler(&instruction, &[VarSetDefault::Dword(500)], &declarations), None ); instruction.header_words[1] = 0; - assert_eq!(stubbed_handler(&instruction, &values), None); + assert_eq!(stubbed_handler(&instruction, &values, &declarations), None); } #[test] @@ -128,13 +145,17 @@ mod tests { references: vec![0], }; let values = [VarSetDefault::Dword(15)]; - assert_eq!(stubbed_handler(&instruction, &values), Some(69)); + let declarations = fparkan_script::parse_varset(b"").unwrap(); + assert_eq!( + stubbed_handler(&instruction, &values, &declarations), + Some(69) + ); assert_eq!( - stubbed_handler(&instruction, &[VarSetDefault::FloatBits(0)]), + stubbed_handler(&instruction, &[VarSetDefault::FloatBits(0)], &declarations), None ); instruction.header_words[1] = 0; - assert_eq!(stubbed_handler(&instruction, &values), None); + assert_eq!(stubbed_handler(&instruction, &values, &declarations), None); } #[test] |
