From d75016f9a98bd30988dc65b59a3c6ce86952e4f8 Mon Sep 17 00:00:00 2001 From: Yorick Date: Wed, 8 Apr 2015 16:13:28 +0200 Subject: [PATCH] FOLLOW WAYPOINT WOO --- Applicatie/Panel.java | 2 +- Applicatie/Visitor.java | 34 ++++++++++++++++++++-------------- Listeners/Mouse.java | 2 +- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Applicatie/Panel.java b/Applicatie/Panel.java index a0d2451..2c55ea0 100644 --- a/Applicatie/Panel.java +++ b/Applicatie/Panel.java @@ -148,7 +148,7 @@ public class Panel extends JPanel implements ActionListener addMouseWheelListener(new MouseWheel(this)); addFocusListener(new WindowFocusListener(this)); - t = new Timer(1000 / 10, this); + t = new Timer(1000 / 100, this); } public int getPanelInfoLength() diff --git a/Applicatie/Visitor.java b/Applicatie/Visitor.java index a3c0aea..569e7d1 100644 --- a/Applicatie/Visitor.java +++ b/Applicatie/Visitor.java @@ -140,28 +140,34 @@ public class Visitor } if (checkIfOnWaypoint(panel)) { - // for(int i : panel.getWaypoint(target).getOptions()) - // { - // if(i == finalTarget) - // { - // target = finalTarget; - // } - // } -// ArrayList options = new ArrayList(); HashMap options = new HashMap(); for (Waypoint w : panel.getWaypoints()) { options.put(w.getSelf(), w.getOptions()); } - for(Map.Entry e : options.entrySet()) + for (Map.Entry e : options.entrySet()) { - System.out.println(e.getKey()); - System.out.println("====================="); - for(int i : e.getValue()) + for (int i : e.getValue()) { - System.out.println(i); + System.out.println("KEY:" + e.getKey()); + System.out.println("VAL:" + i); + System.out.println("TAR: " + target); + + System.out.println("____________"); + if (finalTarget != target) + { + if (finalTarget == i && e.getKey() == target) + { + target = finalTarget; + break; + } + else if (finalTarget == i) + { + target = e.getKey(); + break; + } + } } - System.out.println("----------"); } } diff --git a/Listeners/Mouse.java b/Listeners/Mouse.java index 95f38c5..75d8b1c 100644 --- a/Listeners/Mouse.java +++ b/Listeners/Mouse.java @@ -78,7 +78,7 @@ public class Mouse extends MouseAdapter { if (o instanceof Waypoint) { - new WaypointPopup(o); + new WaypointPopup(o, panel); } }