From 3b5a8aa4e6465ca56763cb96b4100bb1ff1c0ccf Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 2 Dec 2026 18:50:37 +0400 Subject: feat(ui): link the other buildings panel to the satellite map Use the installed compound controls, font, and class glyphs for live clan buildings and their durability. Compare the stock Two Fortresses list order, first selection, two-way map selection, and close behavior in the original and in FParkan with Vulkan validation. --- crates/fparkan-runtime/src/satellite_contacts.rs | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'crates/fparkan-runtime/src/satellite_contacts.rs') diff --git a/crates/fparkan-runtime/src/satellite_contacts.rs b/crates/fparkan-runtime/src/satellite_contacts.rs index 31181bc1..13c918a4 100644 --- a/crates/fparkan-runtime/src/satellite_contacts.rs +++ b/crates/fparkan-runtime/src/satellite_contacts.rs @@ -73,12 +73,26 @@ pub fn visible_buildings( engine: &Engine, cockpit: StartingCockpit, extent: f32, + selected: Option, ) -> impl Iterator + '_ { + let selected = selected.filter(|&target| { + identity_metadata(&engine.world, target) + .ok() + .and_then(|identity| identity.owner_id) + .is_some_and(|owner| { + identity_metadata(&engine.world, cockpit.handle) + .is_ok_and(|identity| identity.owner_id == Some(owner)) + }) + }); visible_contacts(engine, cockpit, extent, |_, class| icon_x(class)).map( - |(pixel, _, _, tint, icon_x)| BuildingContact { + move |(pixel, handle, _, tint, icon_x)| BuildingContact { pixel, icon_x, - tint, + tint: if Some(handle) == selected { + [255; 3] + } else { + tint + }, }, ) } @@ -460,14 +474,14 @@ mod tests { icon_x: 72, tint: super::OWN_TINT, }; - assert!(!visible_buildings(&engine, cockpit, extent).any(|contact| contact == marker)); + assert!(!visible_buildings(&engine, cockpit, extent, None).any(|contact| contact == marker)); let owner = identity_metadata(&engine.world, cockpit.handle) .unwrap() .owner_id; assert!(owner.is_some()); set_owner(&mut engine.world, handle, owner).unwrap(); - assert!(visible_buildings(&engine, cockpit, extent).any(|contact| contact == marker)); + assert!(visible_buildings(&engine, cockpit, extent, None).any(|contact| contact == marker)); let table = loaded_mission_control_device_tables(&engine) .unwrap() @@ -488,6 +502,6 @@ mod tests { assert!(registration_sequence(&engine.world, handle) .unwrap() .is_some()); - assert!(!visible_buildings(&engine, cockpit, extent).any(|contact| contact == marker)); + assert!(!visible_buildings(&engine, cockpit, extent, None).any(|contact| contact == marker)); } } -- cgit v1.2.3