aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/fparkan-runtime/src')
-rw-r--r--crates/fparkan-runtime/src/autodemo.rs10
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(),