This commit is contained in:
Yorick
2015-04-09 01:30:38 +02:00
parent 2e947589be
commit 4897a9440b
+7 -21
View File
@@ -101,8 +101,6 @@ public class Visitor
public void move(DrawObject tar, Panel panel) public void move(DrawObject tar, Panel panel)
{ {
System.out.println("CurrentTarget: " + target);
System.out.println("FinalTarget: " + finalTarget);
Point2D targetPoint = panel.getWaypoint(target).getPosition(); Point2D targetPoint = panel.getWaypoint(target).getPosition();
double newRot = Math.atan2(targetPoint.getY() - position.getY(), targetPoint.getX() - position.getX()); 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()); options.put(w.getSelf(), w.getOptions());
} }
for (Map.Entry<Integer, int[]> e : options.entrySet()) if (finalTarget != target)
{ {
// System.out.println("KEY: " + e.getKey()); for (Map.Entry<Integer, int[]> e : options.entrySet())
for (int i : e.getValue())
{ {
// System.out.println("VAL: " + i); // System.out.println("KEY: " + e.getKey());
if (finalTarget != target) for (int i : e.getValue())
{ {
// System.out.println("VAL: " + i);
if (finalTarget == i && e.getKey() == target) if (finalTarget == i && e.getKey() == target)
{ {
target = finalTarget; target = finalTarget;
@@ -171,7 +170,7 @@ public class Visitor
} }
else if (finalTarget == i) else if (finalTarget == i)
{ {
target = getNextWaypoint(options, e.getKey()); target = e.getKey();
break; break;
} }
} }
@@ -180,19 +179,6 @@ public class Visitor
} }
} }
public int getNextWaypoint(HashMap<Integer, int[]> options, int lastWaypoint)
{
Iterator<Integer> 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) public boolean checkIfOnWaypoint(Panel panel)
{ {
if (panel.getWaypoint(target).contains(position)) if (panel.getWaypoint(target).contains(position))