diff options
author | tom barrett <spalf0@gmail.com> | 2018-02-21 08:54:25 -0600 |
---|---|---|
committer | tom barrett <spalf0@gmail.com> | 2018-02-21 08:54:25 -0600 |
commit | 763653a32e62134a7e394c349d742636b0662a94 (patch) | |
tree | 1f63d99c041bfe5922a4fa8883a062b118165e33 /src | |
parent | 492b31ffd13d4def86050d1db31c5c2e59b670ab (diff) |
-added all directions
Diffstat (limited to 'src')
-rw-r--r-- | src/connection.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/connection.rs b/src/connection.rs index cfe642d..648e1e3 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -27,7 +27,7 @@ impl Connection { let index = match result { Some(index) => index, None => { - let mut ship = Ship::new(name); + let ship = Ship::new(name); ships.push(ship); ships.len() - 1 }, @@ -67,6 +67,11 @@ impl Connection { match self.buff_r.read_line(&mut data) { Ok(_result) => match data.as_bytes() { b"5\n" => ships[self.index].location.0 += 1, + b"0\n" => ships[self.index].location.0 -= 1, + b"8\n" => ships[self.index].location.1 += 1, + b"2\n" => ships[self.index].location.1 -= 1, + b"4\n" => ships[self.index].location.2 += 1, + b"6\n" => ships[self.index].location.2 -= 1, _ => (), }, Err(_error) => println!("b{}", _error) |