diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-02 12:07:11 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-02 12:07:11 +0300 |
| commit | 7dd027fd5130daf532cd2214a6d9689293bb2c86 (patch) | |
| tree | 16750c5f0652031a839d3e1563da73719a9c7afe /crates/fparkan-assets/src | |
| parent | dc92ae05f97d84a1681995e0712b01053e48704c (diff) | |
| download | fparkan-7dd027fd5130daf532cd2214a6d9689293bb2c86.tar.xz fparkan-7dd027fd5130daf532cd2214a6d9689293bb2c86.zip | |
feat(ui): assign search and destroy from the warbot panel
Show the native search status immediately without opening the map. Verify from the stock Two Fortresses start that the selected marker moves with the internal route hidden and that Stand cancels the search.
Diffstat (limited to 'crates/fparkan-assets/src')
| -rw-r--r-- | crates/fparkan-assets/src/strategic_roster.rs | 2 | ||||
| -rw-r--r-- | crates/fparkan-assets/src/strategic_roster/orders.rs | 15 |
2 files changed, 12 insertions, 5 deletions
diff --git a/crates/fparkan-assets/src/strategic_roster.rs b/crates/fparkan-assets/src/strategic_roster.rs index b41e4102..c94281cc 100644 --- a/crates/fparkan-assets/src/strategic_roster.rs +++ b/crates/fparkan-assets/src/strategic_roster.rs @@ -173,7 +173,7 @@ impl RosterImages { &self, rows: &[Row<'_>], card: &[Option<CardLine<'_>>], - orders: Option<([&str; 4], Option<RosterOrder>)>, + orders: Option<([&str; 5], Option<RosterOrder>)>, ) -> Result<RgbaImage, String> { let mut panel = self.background.clone(); if let Some(row) = rows.iter().find(|row| row.selected) { diff --git a/crates/fparkan-assets/src/strategic_roster/orders.rs b/crates/fparkan-assets/src/strategic_roster/orders.rs index 6e6e1e22..d4a6a9ec 100644 --- a/crates/fparkan-assets/src/strategic_roster/orders.rs +++ b/crates/fparkan-assets/src/strategic_roster/orders.rs @@ -12,13 +12,16 @@ pub enum RosterOrder { Stand, /// Draw a route and send it to the unit. FollowRoute, + /// Find and engage hostile mobile units. + SearchAndDestroy, /// Patrol a point or a live object. Patrol, } -const ORDERS: [RosterOrder; 3] = [ +const ORDERS: [RosterOrder; 4] = [ RosterOrder::Stand, RosterOrder::FollowRoute, + RosterOrder::SearchAndDestroy, RosterOrder::Patrol, ]; @@ -27,6 +30,7 @@ impl RosterOrder { match self { Self::Stand => 0, Self::FollowRoute => 1, + Self::SearchAndDestroy => 2, Self::Patrol => 3, } } @@ -81,7 +85,7 @@ impl OrderImages { roster: &RosterImages, panel: &mut RgbaImage, count: usize, - [title, stand, follow, patrol]: [&str; 4], + [title, stand, follow, search, patrol]: [&str; 5], hovered: Option<RosterOrder>, ) -> Result<(), String> { let x = LEFT - ORIGIN[0]; @@ -121,7 +125,7 @@ impl OrderImages { [128; 3], ); } - for (order, label) in ORDERS.into_iter().zip([stand, follow, patrol]) { + for (order, label) in ORDERS.into_iter().zip([stand, follow, search, patrol]) { let y = y + (order.slot() + 1) * ROW_PITCH; let bottom = y + ROW_HEIGHT; let label = roster.font.centered_line(label, 247, ROW_HEIGHT as u16)?; @@ -162,7 +166,10 @@ mod tests { assert_eq!(order_at([250.0, 217.0], 3), None); assert_eq!(order_at([250.0, 218.0], 3), Some(RosterOrder::FollowRoute)); assert_eq!(order_at([250.0, 218.0], 4), Some(RosterOrder::Stand)); - assert_eq!(order_at([250.0, 238.0], 3), None); + assert_eq!( + order_at([250.0, 238.0], 3), + Some(RosterOrder::SearchAndDestroy) + ); assert_eq!(order_at([250.0, 258.0], 3), Some(RosterOrder::Patrol)); } } |
