diff options
author | tom barrett <spalf0@gmail.com> | 2018-02-23 05:04:55 -0600 |
---|---|---|
committer | tom barrett <spalf0@gmail.com> | 2018-02-23 05:04:55 -0600 |
commit | ceb9ee22f32d46a6e49229f447c414f3707eb3ac (patch) | |
tree | 888b5b9824655d05b26f11848ca5290a7e032485 /src/connection.rs | |
parent | 7798ebba1d8762e8b4c6eaf1efcd610fa030375a (diff) |
various ways potentially to deserialize?
Diffstat (limited to 'src/connection.rs')
-rw-r--r-- | src/connection.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/connection.rs b/src/connection.rs index b1a2056..1502d7a 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -88,15 +88,16 @@ impl Connection { let mut within_range = Vec::new(); for mass in masses.iter() { - if distance(ship.location(), mass.location()) > ship.range() { + if distance(ship.location(), mass.location()) < ship.range() { within_range.push(mass); } } let mut send = String::new(); for mass in within_range { send.push_str(&mass.serialize()); - send.push_str("\n"); + send.push_str(","); } + send.push_str("\n"); match self.stream.write(send.as_bytes()) { Ok(_result) => (), Err(_error) => self.open = false, |