From 1a1d90fc6edc85fc3d6440db3a5d582a69a5441d Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 1 Feb 2018 18:39:59 +0100 Subject: Use copy constructor for JBox vectors Signed-off-by: pacien --- src/main/java/fr/umlv/java/wallj/block/JBoxBlock.java | 2 +- src/main/java/fr/umlv/java/wallj/block/RobotBlock.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/fr/umlv/java/wallj/block/JBoxBlock.java b/src/main/java/fr/umlv/java/wallj/block/JBoxBlock.java index 48edbdc..06ecca3 100644 --- a/src/main/java/fr/umlv/java/wallj/block/JBoxBlock.java +++ b/src/main/java/fr/umlv/java/wallj/block/JBoxBlock.java @@ -23,7 +23,7 @@ public abstract class JBoxBlock extends Block { @Override public Vec2 getPos() { if (body == null) throw new IllegalStateException("Uninitialised block."); - return body.getPosition().clone(); + return new Vec2(body.getPosition()); } @Override diff --git a/src/main/java/fr/umlv/java/wallj/block/RobotBlock.java b/src/main/java/fr/umlv/java/wallj/block/RobotBlock.java index 065f367..45c75da 100644 --- a/src/main/java/fr/umlv/java/wallj/block/RobotBlock.java +++ b/src/main/java/fr/umlv/java/wallj/block/RobotBlock.java @@ -29,7 +29,7 @@ public class RobotBlock extends Block { @Override public Vec2 getPos() { - return pos.clone(); + return new Vec2(pos); } @Override -- cgit v1.2.3