From 6cce33ff5b29616fb3d5caf9325729068d0631eb Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 25 Nov 2026 12:57:40 +0400 Subject: feat(ai): select free factories for scripted production Handler(13) UNIT_FREE_UNIT now selects the first live clan object of the requested exact class. Reserved objects, assigned runtime workers and busy factories are skipped. Coverage records each selected logical ID. Campaign mission 8 can execute PBM_ROBOT_NEEDED and replenish its guards. Original GOG ai.dll RVA 0x86fb confirmed roster order, exact class matching, exclusion of busy and reserved entries, and ERROR when none are free. Validated with matching Rust roster cases, a licensed stock mission 8 production test, fmt/check/test workspace, and 900-second simulations of missions 8 and 28. Mission 8 also ran in the window with Vulkan validation. Occupancy is inferred from runtime jobs; native problem-slot ownership, other selection modes and mission chronology beside the original remain open. --- apps/fparkan-game/src/script_coverage.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'apps/fparkan-game/src/script_coverage.rs') diff --git a/apps/fparkan-game/src/script_coverage.rs b/apps/fparkan-game/src/script_coverage.rs index 56d05436..fb1db2bc 100644 --- a/apps/fparkan-game/src/script_coverage.rs +++ b/apps/fparkan-game/src/script_coverage.rs @@ -52,6 +52,11 @@ pub(super) fn log_clan_ai_stops(report: &SimulationReport) { "sim_coverage script_point_patrol_continue_approx={count} clan={clan} x={x} y={y}" ); } + for &(clan, class, unit, count) in &report.script_free_unit_queries { + eprintln!( + "sim_coverage script_free_unit_approx={count} clan={clan} class={class} unit={unit}" + ); + } for &(clan, problem, count) in &report.script_problem_waits { eprintln!("sim_coverage script_problem_wait_approx={count} clan={clan} problem={problem}"); } -- cgit v1.2.3