diff options
Diffstat (limited to 'src/ship.rs')
-rw-r--r-- | src/ship.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ship.rs b/src/ship.rs index 715f019..30a27fb 100644 --- a/src/ship.rs +++ b/src/ship.rs @@ -5,6 +5,13 @@ extern crate serde_json; pub struct Ship { name : String, location : (isize, isize, isize), + r : f64, +} + +impl Ship { + pub fn range(&self) -> f64 { + self.r + } } impl Mass for Ship { @@ -12,18 +19,19 @@ impl Mass for Ship { Ship { name : String::from(name), location : location, + r : 10.0, } } - fn get_name(&self) -> &String { + fn name(&self) -> &String { &self.name } - fn get_location(&self) -> (isize, isize, isize) { + fn location(&self) -> (isize, isize, isize) { self.location } - fn give_location(&mut self, location : (isize, isize, isize)) { + fn set_location(&mut self, location : (isize, isize, isize)) { self.location = location; } |