diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-14 19:06:12 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-14 19:06:12 +0300 |
| commit | c374b6e4b219f9dccaf09c8b709f243ad6eb4290 (patch) | |
| tree | 193777a49a112722e17a2979e79d86cccdbf3b79 /crates/fparkan-script/src | |
| parent | 0d6706145699a51e27e5013f48f59844dc662b9e (diff) | |
| download | fparkan-c374b6e4b219f9dccaf09c8b709f243ad6eb4290.tar.xz fparkan-c374b6e4b219f9dccaf09c8b709f243ad6eb4290.zip | |
fix(script): continue clan Init past the research stub
Оставляем строгую загрузку прежней. В игровом режиме команда без результата отмечена по клану и номеру инструкции, следующие команды исполняются. На штатных ресурсах все 29 миссий запускаются, 12 вызовов дошли до заглушки, а Single.01 завершила Init без обрыва.
Diffstat (limited to 'crates/fparkan-script/src')
| -rw-r--r-- | crates/fparkan-script/src/lib.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/fparkan-script/src/lib.rs b/crates/fparkan-script/src/lib.rs index cacbbd5b..b5b543fe 100644 --- a/crates/fparkan-script/src/lib.rs +++ b/crates/fparkan-script/src/lib.rs @@ -811,6 +811,22 @@ impl VarSet { formulas: Option<&FormulaTable>, clan_count: impl Fn(u32, u32) -> Option<u32>, ) -> Result<Option<ScriptInitPrefix>, ScriptInitResolveError> { + self.resolve_init_prefix_with_host(package, input, formulas, clan_count, |_, _| false) + } + + /// Allows the host to handle an unsupported instruction that has no variable writes. + /// + /// # Errors + /// + /// Returns the same errors as [Self::resolve_init_prefix]. + pub fn resolve_init_prefix_with_host( + &self, + package: &ScriptPackage, + input: Handler19InitInput, + formulas: Option<&FormulaTable>, + clan_count: impl Fn(u32, u32) -> Option<u32>, + mut handle: impl FnMut(usize, &ScriptInstruction) -> bool, + ) -> Result<Option<ScriptInitPrefix>, ScriptInitResolveError> { let Some((event_index, event)) = package.events.iter().enumerate().find(|(_, event)| { event.name_raw.split(|byte| *byte == 0).next() == Some(&b"Init"[..]) }) else { @@ -849,6 +865,9 @@ impl VarSet { prefix.writes.extend(instruction_writes); } InitInstructionResolution::Unsupported(error) => { + if handle(instruction_index, instruction) { + continue; + } prefix.stopped_at = Some((instruction_index, error)); break; } |
