summaryrefslogtreecommitdiff
path: root/src/dashboard.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/dashboard.rs')
-rw-r--r--src/dashboard.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/dashboard.rs b/src/dashboard.rs
index bfad542..c4c3200 100644
--- a/src/dashboard.rs
+++ b/src/dashboard.rs
@@ -5,7 +5,9 @@ use std::io::Write;
extern crate serde_json;
+use mass::Mass;
use ship::Ship;
+use connection::Connection;
pub fn client_dashboard(mut buff_r : BufReader<TcpStream>) {
loop {
@@ -16,10 +18,13 @@ pub fn client_dashboard(mut buff_r : BufReader<TcpStream>) {
}
}
-pub fn server_dashboard(mut ship_string : String, mut stream : &TcpStream) -> bool {
- ship_string.push_str("\n");
- match stream.write(ship_string.as_bytes()) {
- Ok(_result) => true,
- Err(_error) => false,
+impl Connection {
+ pub fn server_dashboard(&mut self, masses : &mut Vec<Box<Mass>>) -> bool {
+ let mut ship_string = masses[self.index].serialize();
+ ship_string.push_str("\n");
+ match self.stream.write(ship_string.as_bytes()) {
+ Ok(_result) => true,
+ Err(_error) => false,
+ }
}
}