aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/clan_ai_events.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-14 20:07:29 +0300
committerValentin Popov <valentin@popov.link>2026-11-14 20:07:29 +0300
commit423ef8a52d38721b296791c887ec3674f18e74c8 (patch)
treead9ea861ca04b546b29c4f45a85f52d779cbd033 /crates/fparkan-runtime/src/clan_ai_events.rs
parent6e18e9f05c1ae92a54dd671b6e47f3e21e299d4f (diff)
downloadfparkan-423ef8a52d38721b296791c887ec3674f18e74c8.tar.xz
fparkan-423ef8a52d38721b296791c887ec3674f18e74c8.zip
fix(ai): report unloaded research status during problem checks
Handler(65) can continue with the native unloaded-catalog result, with an explicit per-clan count. A direct ai.dll call confirms the unloaded and no-table guards. Single.01 now reaches the float resource result.
Diffstat (limited to 'crates/fparkan-runtime/src/clan_ai_events.rs')
-rw-r--r--crates/fparkan-runtime/src/clan_ai_events.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/clan_ai_events.rs b/crates/fparkan-runtime/src/clan_ai_events.rs
index caca586c..e0ed4906 100644
--- a/crates/fparkan-runtime/src/clan_ai_events.rs
+++ b/crates/fparkan-runtime/src/clan_ai_events.rs
@@ -7,6 +7,7 @@ use std::collections::BTreeMap;
pub(super) struct ClanAiEvents {
next_ms: BTreeMap<usize, u32>,
stops: BTreeMap<(usize, usize, usize), (MissionEventStop, u64)>,
+ research_status_stubs: BTreeMap<usize, u64>,
}
impl LoadedMissionState {
@@ -66,6 +67,22 @@ impl LoadedMissionState {
class,
)))
}
+ ScriptDispatchSelector::Handler(65) if instruction.references.is_empty() => {
+ // RVA 0x111d0 returns false while the research catalog is unloaded.
+ let count = self
+ .clan_ai_events
+ .research_status_stubs
+ .entry(clan)
+ .or_default();
+ *count += 1;
+ if *count == 1 {
+ eprintln!(
+ "sim_coverage script_research_status_stub=1 clan={clan} script={}",
+ bundle.script_path
+ );
+ }
+ Ok(Some(0))
+ }
selector => Err(format!("{selector:?}")),
},
);
@@ -113,6 +130,12 @@ impl ClanAiEvents {
pub(super) fn stops(&self) -> impl Iterator<Item = (&MissionEventStop, u64)> {
self.stops.values().map(|(stop, count)| (stop, *count))
}
+
+ pub(super) fn research_status_stubs(&self) -> impl Iterator<Item = (usize, u64)> + '_ {
+ self.research_status_stubs
+ .iter()
+ .map(|(&clan, &count)| (clan, count))
+ }
}
#[cfg(test)]