Commit 48ea54f2 authored by Jakob Schöttl's avatar Jakob Schöttl
Browse files

Use Agent.getNextTargetId() method

There was a
assert targetIds.size() > 0

That means, this case is not expected, right?
Why is this case handled then in the next lines?

I switched the assert statement against getNextTargetId() which throws
an exception if there is no next target.

Use hasNextTarget() if you have to check this.
parent 0b1f21be
......@@ -54,15 +54,8 @@ public abstract class AbstractPotentialFieldTarget implements IPotentialTargetGr
CellGrid potentialField;
double targetPotential = Double.MAX_VALUE;
int targetId = -1;
assert targetIds.size() > 0;
if (targetIds.size() > 0) {
targetId = targetIds.get(0);
} else {
return 0;
}
int targetId = ped.getNextTargetId();
// Pedestrian has reached the target
if (topography.getTarget(targetId) != null) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment