mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-24 20:10:15 -08:00
work on some computer functions
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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:'")
|
||||
}
|
||||
Reference in New Issue
Block a user