From ceb9ee22f32d46a6e49229f447c414f3707eb3ac Mon Sep 17 00:00:00 2001 From: tom barrett Date: Fri, 23 Feb 2018 05:04:55 -0600 Subject: various ways potentially to deserialize? --- src/connection.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/connection.rs') 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, -- cgit v1.2.3