diff --git a/Applicatie/Visitor.java b/Applicatie/Visitor.java index c69d4e0..160fe0a 100644 --- a/Applicatie/Visitor.java +++ b/Applicatie/Visitor.java @@ -101,8 +101,6 @@ public class Visitor public void move(DrawObject tar, Panel panel) { - System.out.println("CurrentTarget: " + target); - System.out.println("FinalTarget: " + finalTarget); Point2D targetPoint = panel.getWaypoint(target).getPosition(); double newRot = Math.atan2(targetPoint.getY() - position.getY(), targetPoint.getX() - position.getX()); @@ -156,14 +154,15 @@ public class Visitor options.put(w.getSelf(), w.getOptions()); } - for (Map.Entry e : options.entrySet()) + if (finalTarget != target) { - // System.out.println("KEY: " + e.getKey()); - for (int i : e.getValue()) + for (Map.Entry e : options.entrySet()) { - // System.out.println("VAL: " + i); - if (finalTarget != target) + // System.out.println("KEY: " + e.getKey()); + for (int i : e.getValue()) { + // System.out.println("VAL: " + i); + if (finalTarget == i && e.getKey() == target) { target = finalTarget; @@ -171,7 +170,7 @@ public class Visitor } else if (finalTarget == i) { - target = getNextWaypoint(options, e.getKey()); + target = e.getKey(); break; } } @@ -180,19 +179,6 @@ public class Visitor } } - public int getNextWaypoint(HashMap options, int lastWaypoint) - { - Iterator it = options.keySet().iterator(); - for (int i : options.get(lastWaypoint)) - { - while (it.hasNext()) - { - System.out.println(it.next()); - } - } - return lastWaypoint; - } - public boolean checkIfOnWaypoint(Panel panel) { if (panel.getWaypoint(target).contains(position))