work on some computer functions

This commit is contained in:
Christopher
2023-03-05 07:49:25 +13:00
parent 15cf7b31ff
commit c4d4f820ac
2 changed files with 24 additions and 0 deletions

View File

@@ -307,11 +307,27 @@ pub fn access_computer(galaxy: &Galaxy, provided: Vec<String>) {
match operation {
0 => view::galaxy_scanned_map(galaxy),
3 => show_starbase_data(galaxy),
5 => view::galaxy_region_map(),
_ => todo!() // todo implement others
}
}
fn show_starbase_data(galaxy: &Galaxy) {
let quadrant = &galaxy.quadrants[galaxy.enterprise.quadrant.as_index()];
match &quadrant.star_base {
None => {
view::no_local_starbase();
return;
},
Some(s) => {
view::starbase_report();
let pos = s.sector;
// calulcate direction and distance then print
}
}
}
pub fn get_power_and_fire_phasers(galaxy: &mut Galaxy, provided: Vec<String>) {
if galaxy.enterprise.damaged.contains_key(systems::PHASERS) {
view::inoperable(&systems::name_for(systems::PHASERS));

View File

@@ -579,4 +579,12 @@ court martial!")
That does it, Captain!! You are hereby relieved of command
and sentenced to 99 stardates at hard labor on Cygnus 12!!")
}
}
pub fn no_local_starbase() {
println!("Mr. Spock reports, 'Sensors show no starbases in this quadrant.'")
}
pub fn starbase_report() {
println!("From Enterprise to Starbase:'")
}