From 667ce1cb0af2b16c7ffa55f9b10838d3bb1377ea Mon Sep 17 00:00:00 2001 From: Phillip Date: Mon, 14 Mar 2011 17:22:08 +0000 Subject: Removed World Reference as it CANNOT be serialized (oops!) --- src/tesseract/objects/remote/RemoteObject.java | 2 +- src/tesseract/objects/remote/RemoteObjectMenu.java | 2 +- src/tesseract/objects/remote/TankMenuItem.java | 10 +++++----- src/tesseract/objects/tank/Body.java | 7 +++---- src/tesseract/objects/tank/Tank.java | 15 +++++++-------- 5 files changed, 17 insertions(+), 19 deletions(-) (limited to 'src/tesseract/objects') diff --git a/src/tesseract/objects/remote/RemoteObject.java b/src/tesseract/objects/remote/RemoteObject.java index 789a545..e3edc1c 100644 --- a/src/tesseract/objects/remote/RemoteObject.java +++ b/src/tesseract/objects/remote/RemoteObject.java @@ -68,6 +68,6 @@ public abstract class RemoteObject extends PhysicalObject { keyEventReceived(keyEvent); updateTranformGroup(); - } + } } diff --git a/src/tesseract/objects/remote/RemoteObjectMenu.java b/src/tesseract/objects/remote/RemoteObjectMenu.java index 606e9bb..3d4435e 100644 --- a/src/tesseract/objects/remote/RemoteObjectMenu.java +++ b/src/tesseract/objects/remote/RemoteObjectMenu.java @@ -27,7 +27,7 @@ public class RemoteObjectMenu extends JMenu { myControlledObjects = new ArrayList(); // Objects that can be added - add(new TankMenuItem(this, theWorld)); + add(new TankMenuItem(this)); // Separator addSeparator(); diff --git a/src/tesseract/objects/remote/TankMenuItem.java b/src/tesseract/objects/remote/TankMenuItem.java index 3cebb33..4e18a9c 100644 --- a/src/tesseract/objects/remote/TankMenuItem.java +++ b/src/tesseract/objects/remote/TankMenuItem.java @@ -6,15 +6,15 @@ import tesseract.World; import tesseract.objects.tank.Tank; public class TankMenuItem extends RemoteObjectMenuItem { - private final World myWorld; - public TankMenuItem(final RemoteObjectMenu theMenu, World theWorld) { + + public TankMenuItem(final RemoteObjectMenu theMenu) { super("Tank", theMenu); - myWorld = theWorld; + } @Override protected RemoteObject createRemoteObject() { - return new Tank(new Vector3f(), 1, myWorld); - } + return new Tank(new Vector3f(), 1); + } } diff --git a/src/tesseract/objects/tank/Body.java b/src/tesseract/objects/tank/Body.java index c256d5b..ff0e56d 100644 --- a/src/tesseract/objects/tank/Body.java +++ b/src/tesseract/objects/tank/Body.java @@ -6,7 +6,6 @@ import javax.media.j3d.Appearance; import javax.media.j3d.ColoringAttributes; import javax.media.j3d.Geometry; import javax.media.j3d.GeometryArray; -import javax.media.j3d.Group; import javax.media.j3d.Material; import javax.media.j3d.Shape3D; import javax.media.j3d.Transform3D; @@ -14,7 +13,7 @@ import javax.media.j3d.TransformGroup; import javax.vecmath.Color3f; import javax.vecmath.Vector3f; -import tesseract.World; + import com.sun.j3d.utils.geometry.Box; import com.sun.j3d.utils.geometry.Cylinder; @@ -35,7 +34,7 @@ public class Body { private Vector3f[] vectors; - public Body(Color trackColor, Color bodyColor, float theScale, Color turretColor, World theWorld) { + public Body(Color trackColor, Color bodyColor, float theScale, Color turretColor) { body = new TransformGroup(); turret = new TransformGroup(); barrel = new TransformGroup(); @@ -127,5 +126,5 @@ public class Body { public Vector3f getFacing() { return vectors[0]; - } + } } diff --git a/src/tesseract/objects/tank/Tank.java b/src/tesseract/objects/tank/Tank.java index d9975b3..059efa5 100644 --- a/src/tesseract/objects/tank/Tank.java +++ b/src/tesseract/objects/tank/Tank.java @@ -27,22 +27,21 @@ public class Tank extends RemoteObject { private static final int maxBarrelElevation = 14; private static final int minBarrelElevation = -1; - public Tank(final Vector3f thePosition, final float mass, - final World theWorld) { - this(thePosition, mass, DEFAULT_SCALE, theWorld); + public Tank(final Vector3f thePosition, final float mass) { + this(thePosition, mass, DEFAULT_SCALE); } public Tank(final Vector3f thePosition, final float mass, - final float theScale, final World theWorld) { + final float theScale) { this(thePosition, mass, theScale, DEFAULT_BODY_COLOR, - DEFAULT_TRACK_COLOR, DEFAULT_TURRET_COLOR, theWorld); + DEFAULT_TRACK_COLOR, DEFAULT_TURRET_COLOR); } public Tank(final Vector3f thePosition, final float mass, final float theScale, final Color bodyColor, final Color trackColor, - final Color turretColor, final World theWorld) { + final Color turretColor) { super (thePosition, mass); - tank = new Body(trackColor, bodyColor, theScale, turretColor, theWorld); + tank = new Body(trackColor, bodyColor, theScale, turretColor); //orientation = new Vector3f(); aim = new Vector3f(); gunLocation = new Point3f(); @@ -148,7 +147,7 @@ public class Tank extends RemoteObject { barrelElevation--; } break; - } + } } -- cgit v1.2.3