From e40f043b0c4e0e5754cf2e57dd6f580cf96d9d72 Mon Sep 17 00:00:00 2001 From: Joseph Walton-Rivers <jwalto@essex.ac.uk> Date: Thu, 11 Jun 2015 14:40:43 +0100 Subject: [PATCH] fixed NPE on cloning ships --- src/battle/NeuroShip.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/battle/NeuroShip.java b/src/battle/NeuroShip.java index a2fcafa..5cfd994 100644 --- a/src/battle/NeuroShip.java +++ b/src/battle/NeuroShip.java @@ -37,8 +37,6 @@ public class NeuroShip extends GameObject { static double gravity = 0.0; - public Action action; - // position and velocity public Vector2d d; @@ -50,7 +48,6 @@ public class NeuroShip extends GameObject { public NeuroShip copy() { NeuroShip ship = new NeuroShip(s, v, d); - ship.action = new Action(action); ship.releaseVelocity = releaseVelocity; return ship; } @@ -73,10 +70,6 @@ public class NeuroShip extends GameObject { // System.out.println("Reset the ship "); } - public void update() { - update(action); - } - public NeuroShip update(Action action) { // what if this is always on? @@ -129,6 +122,11 @@ public class NeuroShip extends GameObject { return s + "\t " + v; } + @Override + public void update() { + throw new IllegalArgumentException("You shouldn't be calling this..."); + } + public void draw(Graphics2D g) { AffineTransform at = g.getTransform(); g.translate(s.x, s.y); -- GitLab