diff options
| author | Valentin Popov <valentin@popov.link> | 2026-12-02 08:25:22 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-12-02 08:25:22 +0300 |
| commit | 9f360911f4af29307b566c0acacf1f5661ea9970 (patch) | |
| tree | 9477bb8961f835fffe75d8e5a9d3cf5fe88720b8 /crates/fparkan-runtime/src | |
| parent | ea9051e68a9de762a3d6f79c2e8d26bd1ce4310c (diff) | |
| download | fparkan-9f360911f4af29307b566c0acacf1f5661ea9970.tar.xz fparkan-9f360911f4af29307b566c0acacf1f5661ea9970.zip | |
feat(ui): show the original strategic toolbar in AutoDemo
Diffstat (limited to 'crates/fparkan-runtime/src')
| -rw-r--r-- | crates/fparkan-runtime/src/autodemo.rs | 10 |
1 files changed, 9 insertions, 1 deletions
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<u32> { } 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<StartingCockpit> { - 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(), |
