summaryrefslogtreecommitdiff
path: root/src/dashboard.rs
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2018-03-05 08:14:14 -0600
committertom barrett <spalf0@gmail.com>2018-03-05 08:14:14 -0600
commit160d7b6e50df6d818f6882c033398d49193bd804 (patch)
treeb211d052dce89c9c69012c8e6c7f9de648322086 /src/dashboard.rs
parent233aa5d803e8015f78f663bc9af6bb33e56eb96e (diff)
-brought back downcasting, moved connection functions inside the structure
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,
+ }
}
}