From 5973d97a16ed00a94e786a8e79557ed6125c6065 Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 2 Mar 2023 21:35:45 +1300 Subject: [PATCH] some more reorg --- 84_Super_Star_Trek/rust/src/commands.rs | 7 +------ 84_Super_Star_Trek/rust/src/view.rs | 11 ++++++++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/84_Super_Star_Trek/rust/src/commands.rs b/84_Super_Star_Trek/rust/src/commands.rs index 52ca5daf..911f88f5 100644 --- a/84_Super_Star_Trek/rust/src/commands.rs +++ b/84_Super_Star_Trek/rust/src/commands.rs @@ -209,12 +209,7 @@ pub fn display_damage_control(enterprise: &Enterprise) { return; } - println!("Device State of Repair"); - for key in systems::KEYS { - let damage = enterprise.damaged.get(key).unwrap_or(&0.0); - println!("{:<25}{}", systems::name_for(key), damage) - } - println!(); + view::damage_control(enterprise); } pub fn perform_long_range_scan(galaxy: &mut Galaxy) { diff --git a/84_Super_Star_Trek/rust/src/view.rs b/84_Super_Star_Trek/rust/src/view.rs index 1c904958..290fa37b 100644 --- a/84_Super_Star_Trek/rust/src/view.rs +++ b/84_Super_Star_Trek/rust/src/view.rs @@ -1,4 +1,4 @@ -use crate::model::{Galaxy, Pos, EndPosition, SectorStatus}; +use crate::model::{Galaxy, Pos, EndPosition, SectorStatus, Enterprise, systems}; pub fn full_instructions() { println!( @@ -342,6 +342,15 @@ pub fn system_repair_completed(name: String) { println!(" {name} repair completed.") } +pub fn damage_control(enterprise: &Enterprise) { + println!("Device State of Repair"); + for key in systems::KEYS { + let damage = enterprise.damaged.get(key).unwrap_or(&0.0); + println!("{:<25}{}", systems::name_for(key), damage) + } + println!(); +} + pub fn long_range_scan(galaxy: &Galaxy) -> Vec { let cx = galaxy.enterprise.quadrant.0 as i8;