From 5cc5602b3fa42e5864d205a1c42c895504038b10 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 25 Nov 2026 20:14:25 +0400 Subject: fix(ai): start player and clan cycles on the first update Fresh AI contexts enter their first cycle immediately, including the player context with an empty Problems0. Share their logical clock with Mission timeouts and registration notifications. The stock original confirms the first Mission callback sees zero before the first AI cycle. Run the player Problems0 path and support TAKE_ALL_BATTLE_UNITS: preserve reserved and same-kind assignments, take warbots from other combat tasks. Native ai.dll calls verify recruitment and the initial shared RNG draws. Validation: workspace fmt/check/tests, release build, licensed stock-clock test, all 29 stock missions at --sim-report 900 without script stops, and stock mission windows 28 and 20. Full AI chronology, native occupancy and remaining RNG consumers are still approximate. --- crates/fparkan-runtime/src/script_time.rs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'crates/fparkan-runtime/src/script_time.rs') diff --git a/crates/fparkan-runtime/src/script_time.rs b/crates/fparkan-runtime/src/script_time.rs index 55e3f3d1..86ba44b9 100644 --- a/crates/fparkan-runtime/src/script_time.rs +++ b/crates/fparkan-runtime/src/script_time.rs @@ -35,11 +35,6 @@ pub(super) fn result( } } -// shortcut: approximate the native AI scheduler's logical seconds by mission elapsed seconds. -pub(super) fn elapsed_seconds(start_ms: u32, now_ms: u32) -> u32 { - now_ms.wrapping_sub(start_ms) / 1_000 -} - #[cfg(test)] mod tests { use super::*; -- cgit v1.2.3