summaryrefslogtreecommitdiff
path: root/src/mass.rs
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2018-03-01 03:51:36 -0600
committertom barrett <spalf0@gmail.com>2018-03-01 03:51:36 -0600
commit233aa5d803e8015f78f663bc9af6bb33e56eb96e (patch)
tree797240efc2d00c02b5b4c3ea493595226f96a88d /src/mass.rs
parent3d0efb20ac17ae18c495ffbb1b7d28b22851cb28 (diff)
-added copying of mass vector, fixed buildmass bug, and allow giving of target
Diffstat (limited to 'src/mass.rs')
-rw-r--r--src/mass.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mass.rs b/src/mass.rs
index 30442ec..d6feb6c 100644
--- a/src/mass.rs
+++ b/src/mass.rs
@@ -7,9 +7,18 @@ pub trait Mass : Any {
fn process(&mut self);
fn slow(&mut self);
fn give_acceleration(&mut self, acceleration : (f64, f64, f64));
+ fn box_clone(&self) -> Box<Mass>;
+ fn range(&self) -> f64;
+ fn give_target(&mut self, target : Option<usize>);
}
-#[derive(Serialize, Deserialize, Debug)]
+impl Clone for Box<Mass> {
+ fn clone(&self) -> Box<Mass> {
+ self.box_clone()
+ }
+}
+
+#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum Type {
Ship,
Astroid,