Actions is nul wtf

This commit is contained in:
Yorick
2015-04-08 17:17:53 +02:00
parent b5cf44b44c
commit 89036d27af
2 changed files with 9 additions and 14 deletions
+2 -2
View File
@@ -34,8 +34,8 @@ public class Event implements Serializable {
endHour, endMinute); endHour, endMinute);
this.startHour = startHour; this.startHour = startHour;
this.startMinute = startMinute; this.startMinute = startMinute;
this.stopHour = stopHour; this.stopHour = endHour;
this.stopMinute = stopMinute; this.stopMinute = endMinute;
this.stage = stage; this.stage = stage;
this.artist = artist; this.artist = artist;
this.description = description; this.description = description;
+7 -12
View File
@@ -56,9 +56,8 @@ public class Visitor
this.agenda = agenda; this.agenda = agenda;
this.objects = objects; this.objects = objects;
fillActions(); fillActions();
System.out.println(actions.size());
target = 1; target = 1;
finalTarget = 4; finalTarget = 0;
} }
public void draw(Graphics2D g2) public void draw(Graphics2D g2)
@@ -97,10 +96,11 @@ public class Visitor
{ {
if (currentTime >= a.getStartTime() && currentTime < a.getStoptime()) 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); // moveToTarget(target, objects, visitors, paths);
move(target, panel); move(target, panel);
@@ -166,11 +166,6 @@ public class Visitor
{ {
for (int i : e.getValue()) 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 != target)
{ {
if (finalTarget == i && e.getKey() == target) if (finalTarget == i && e.getKey() == target)
@@ -427,7 +422,7 @@ public class Visitor
int randomtime = (int) (40 + (Math.random() * (60 - 40))); int randomtime = (int) (40 + (Math.random() * (60 - 40)));
if (position != null) if (position != null)
{ {
Waypoint w = getClosedWaypoint(position); Waypoint w = getClosestWaypoint(position);
actions.add(new Action(position, startTime, randomtime, targetStage, w)); actions.add(new Action(position, startTime, randomtime, targetStage, w));
} }
startTime = startTime + randomtime; startTime = startTime + randomtime;
@@ -451,7 +446,7 @@ public class Visitor
int r = (int) Math.floor(Math.random() * foodPlaces.size()); int r = (int) Math.floor(Math.random() * foodPlaces.size());
position = foodPlaces.get(r).getPosition(); position = foodPlaces.get(r).getPosition();
targetStage = foodPlaces.get(r); targetStage = foodPlaces.get(r);
Waypoint w = getClosedWaypoint(position); Waypoint w = getClosestWaypoint(position);
actions.add(new Action(position, startTime, 35, targetStage, w)); actions.add(new Action(position, startTime, 35, targetStage, w));
startTime = startTime + 20; startTime = startTime + 20;
} }
@@ -475,7 +470,7 @@ public class Visitor
int r = (int) Math.floor(Math.random() * toilets.size()); int r = (int) Math.floor(Math.random() * toilets.size());
position = toilets.get(r).getPosition(); position = toilets.get(r).getPosition();
targetStage = toilets.get(r); targetStage = toilets.get(r);
Waypoint w = getClosedWaypoint(position); Waypoint w = getClosestWaypoint(position);
actions.add(new Action(position, startTime, 35, targetStage, w)); actions.add(new Action(position, startTime, 35, targetStage, w));
startTime = startTime + 20; startTime = startTime + 20;
} }
@@ -485,7 +480,7 @@ public class Visitor
} }
} }
public Waypoint getClosedWaypoint(Point2D point) public Waypoint getClosestWaypoint(Point2D point)
{ {
Waypoint waypoint = null; Waypoint waypoint = null;
int distance = 10000; int distance = 10000;