diff options
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/mining.rs | 12 | ||||
-rw-r--r-- | src/client/refinery.rs | 5 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/client/mining.rs b/src/client/mining.rs index f0fcbd0..80cd611 100644 --- a/src/client/mining.rs +++ b/src/client/mining.rs @@ -8,6 +8,7 @@ use std::io::{stdout, Read, Write}; use self::termion::raw::IntoRawMode; use server::mining::MiningData; +use modules::mining::MiningStatus; pub fn client_mining(mut stream : TcpStream, mut buff_r : BufReader<TcpStream>) { let stdout = stdout(); @@ -25,10 +26,13 @@ pub fn client_mining(mut stream : TcpStream, mut buff_r : BufReader<TcpStream>) match data.has_astroid_target { true => match data.is_within_range { - true => match data.status { - true => write!(stdout, "{}Press F to stop mining.", clear).unwrap(), - false => write!(stdout, "{}Press F to begin mining.", clear).unwrap(), - } + true => match data.astroid_has_minerals { + true => match data.status { + MiningStatus::None => write!(stdout, "{}Press F to begin mining.", clear).unwrap(), + _ => write!(stdout, "{}Press F to stop mining.", clear).unwrap(), + }, + false => write!(stdout, "{}Astroid has ran out of minerals.", clear).unwrap(), + } false => write!(stdout, "{}Astroid must be within range of {}.", clear, data.range).unwrap(), }, false => write!(stdout, "{}Ship has no astroid targeted.", clear).unwrap(), diff --git a/src/client/refinery.rs b/src/client/refinery.rs index 4f437df..5f126bf 100644 --- a/src/client/refinery.rs +++ b/src/client/refinery.rs @@ -8,6 +8,7 @@ use std::io::{stdout, Read, Write}; use self::termion::raw::IntoRawMode; use server::refinery::RefineryData; +use modules::refinery::RefineryStatus; pub fn client_refinery(mut stream : TcpStream, mut buff_r : BufReader<TcpStream>) { let stdout = stdout(); @@ -25,8 +26,8 @@ pub fn client_refinery(mut stream : TcpStream, mut buff_r : BufReader<TcpStream> match data.has_minerals { true => match data.status { - true => write!(stdout, "{}Press R to stop refining.", clear).unwrap(), - false => write!(stdout, "{}Press R to begin refining.", clear).unwrap(), + RefineryStatus::None => write!(stdout, "{}Press R to begin refining.", clear).unwrap(), + _ => write!(stdout, "{}Press R to stop refining.", clear).unwrap(), }, false => write!(stdout, "{}You have no refinable minerals.", clear).unwrap(), } |