From 89036d27afc0d303dc1185a4c0a7ea702cadcf03 Mon Sep 17 00:00:00 2001 From: Yorick Date: Wed, 8 Apr 2015 17:17:53 +0200 Subject: [PATCH] Actions is nul wtf --- Agenda/Event.java | 4 ++-- Applicatie/Visitor.java | 19 +++++++------------ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Agenda/Event.java b/Agenda/Event.java index c873c43..90acfb5 100644 --- a/Agenda/Event.java +++ b/Agenda/Event.java @@ -34,8 +34,8 @@ public class Event implements Serializable { endHour, endMinute); this.startHour = startHour; this.startMinute = startMinute; - this.stopHour = stopHour; - this.stopMinute = stopMinute; + this.stopHour = endHour; + this.stopMinute = endMinute; this.stage = stage; this.artist = artist; this.description = description; diff --git a/Applicatie/Visitor.java b/Applicatie/Visitor.java index d4d5119..578b3f2 100644 --- a/Applicatie/Visitor.java +++ b/Applicatie/Visitor.java @@ -56,9 +56,8 @@ public class Visitor this.agenda = agenda; this.objects = objects; fillActions(); - System.out.println(actions.size()); target = 1; - finalTarget = 4; + finalTarget = 0; } public void draw(Graphics2D g2) @@ -97,10 +96,11 @@ public class Visitor { if (currentTime >= a.getStartTime() && currentTime < a.getStoptime()) { - target = a.getTargetObject(); + this.finalTarget = a.getWaypoint().getSelf(); } } + System.out.println(actions.size()); // moveToTarget(target, objects, visitors, paths); move(target, panel); @@ -166,11 +166,6 @@ public class Visitor { for (int i : e.getValue()) { - 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) @@ -427,7 +422,7 @@ public class Visitor int randomtime = (int) (40 + (Math.random() * (60 - 40))); if (position != null) { - Waypoint w = getClosedWaypoint(position); + Waypoint w = getClosestWaypoint(position); actions.add(new Action(position, startTime, randomtime, targetStage, w)); } startTime = startTime + randomtime; @@ -451,7 +446,7 @@ public class Visitor int r = (int) Math.floor(Math.random() * foodPlaces.size()); position = foodPlaces.get(r).getPosition(); targetStage = foodPlaces.get(r); - Waypoint w = getClosedWaypoint(position); + Waypoint w = getClosestWaypoint(position); actions.add(new Action(position, startTime, 35, targetStage, w)); startTime = startTime + 20; } @@ -475,7 +470,7 @@ public class Visitor int r = (int) Math.floor(Math.random() * toilets.size()); position = toilets.get(r).getPosition(); targetStage = toilets.get(r); - Waypoint w = getClosedWaypoint(position); + Waypoint w = getClosestWaypoint(position); actions.add(new Action(position, startTime, 35, targetStage, w)); startTime = startTime + 20; } @@ -485,7 +480,7 @@ public class Visitor } } - public Waypoint getClosedWaypoint(Point2D point) + public Waypoint getClosestWaypoint(Point2D point) { Waypoint waypoint = null; int distance = 10000;