From 9f360911f4af29307b566c0acacf1f5661ea9970 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 2 Dec 2026 09:25:22 +0400 Subject: feat(ui): show the original strategic toolbar in AutoDemo --- crates/fparkan-runtime/src/autodemo.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'crates/fparkan-runtime') diff --git a/crates/fparkan-runtime/src/autodemo.rs b/crates/fparkan-runtime/src/autodemo.rs index ab793fb2..d7b53438 100644 --- a/crates/fparkan-runtime/src/autodemo.rs +++ b/crates/fparkan-runtime/src/autodemo.rs @@ -431,9 +431,14 @@ fn read_setting(bytes: &[u8], key: &str) -> Option { } impl AutoDemoCamera { + /// The original draws the command toolbar throughout the strategic interval. + pub fn shows_strategy_toolbar(&self) -> bool { + self.phase == 0 && self.last_clock_ms.is_some() + } + /// Unit selected while the automatic camera shows the strategic map. pub fn strategy_map_target(&self, snapshot: &WorldSnapshot) -> Option { - if self.phase != 0 || self.last_clock_ms.is_none() { + if !self.shows_strategy_toolbar() { return None; } self.targets @@ -607,10 +612,12 @@ mod tests { ], }; let terrain = |_| Ok(Some(0.0)); + assert!(!demo.shows_strategy_toolbar()); assert!(matches!( demo.sample_with_height(0, &snapshot, terrain).unwrap(), AutoDemoView::Exterior { bird: false, .. } )); + assert!(demo.shows_strategy_toolbar()); assert_eq!( demo.strategy_map_target(&snapshot) .map(|target| target.handle), @@ -624,6 +631,7 @@ mod tests { demo.sample_with_height(5_001, &snapshot, terrain).unwrap(), AutoDemoView::Exterior { bird: true, .. } )); + assert!(!demo.shows_strategy_toolbar()); assert!(demo.strategy_map_target(&snapshot).is_none()); assert!(matches!( demo.sample_with_height(15_001, &snapshot, terrain).unwrap(), -- cgit v1.2.3