From f707bc6179521d316a93dde9beca2668115ad6cd Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Nov 2026 12:36:35 +0400 Subject: fix(factory): rank researched combat designs for clan orders Use the clan technology table to qualify candidates for SELECT_STRONGEST, then compare their projected Control endurance and weapon banks. The stock Two Fortresses factory releases 12spd1.dat in about ten seconds. Checked the selector with the original DLL, the first release and reservation in licensed tests, and the new model in the game window. --- crates/fparkan-runtime/src/clan_combat_strength.rs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'crates/fparkan-runtime/src/clan_combat_strength.rs') diff --git a/crates/fparkan-runtime/src/clan_combat_strength.rs b/crates/fparkan-runtime/src/clan_combat_strength.rs index 2ad01692..0dcbd7e2 100644 --- a/crates/fparkan-runtime/src/clan_combat_strength.rs +++ b/crates/fparkan-runtime/src/clan_combat_strength.rs @@ -1,6 +1,7 @@ use crate::{ - control_device_provider_value_from_status, MissionControlDeviceTableState, - MissionControlDeviceTableStatus, ObjectHandle, + control_device_provider_value_from_status, EffectiveControlDevice, + MissionControlDeviceTableState, MissionControlDeviceTableStatus, + MissionControlNodeProviderTableStatus, ObjectHandle, }; pub(super) fn unit_strength( @@ -14,6 +15,15 @@ pub(super) fn unit_strength( let MissionControlDeviceTableStatus::Available(devices) = &table.status else { return rating(capacity, 0.0); }; + // shortcut: assume full design ammunition and use the live Control amount + // until selector 0x36 scaling and live weapon counters are wired. + rating(capacity, weapon_power(devices, &table.node_provider_status)) +} + +pub(super) fn weapon_power( + devices: &[EffectiveControlDevice], + providers: &MissionControlNodeProviderTableStatus, +) -> f32 { let mut grouped = false; let mut weapon_power = 0.0; for device in devices { @@ -25,7 +35,7 @@ pub(super) fn unit_strength( else { continue; }; - if control_device_provider_value_from_status(&table.node_provider_status, device) + if control_device_provider_value_from_status(providers, device) .is_ok_and(|health| health == 0.0) { continue; @@ -39,12 +49,10 @@ pub(super) fn unit_strength( _ => {} } } - // shortcut: assume full design ammunition and use the live Control amount - // until selector 0x36 scaling and live weapon counters are wired. - rating(capacity, weapon_power) + weapon_power } -fn rating(capacity: f32, weapon_power: f32) -> f32 { +pub(super) fn rating(capacity: f32, weapon_power: f32) -> f32 { ((weapon_power + 0.8_f32) * capacity) * 0.00001_f32 } -- cgit v1.2.3