Commit 99d40599 authored by Julian Zobel's avatar Julian Zobel
Browse files

Bugfix in alternative routing for realworld street movement.

parent db095e8a
......@@ -248,12 +248,21 @@ public class RealWorldStreetsMovement extends AbstractLocalMovementStrategy {
// alternative route is taken with a certain chance
if(random.nextDouble() <= probabilityForAlternativeRoute) {
List<PathWrapper> paths = rsp.getAll();
int pick = random.nextInt(paths.size() - 1) + 1;
pointList = rsp.getAll().get(pick).getPoints();
// remove the best, we do not want this!
paths.remove(rsp.getBest());
PathWrapper choice;
if(paths.size() == 1) {
choice = paths.get(0);
}
else {
choice = paths.get(random.nextInt(paths.size() - 1) + 1);
}
//PointList pointList = rsp.getBest().getPoints();
pointList = choice.getPoints();
}
}
if (isCalculateRouteSegments()) {
/*
......@@ -262,7 +271,7 @@ public class RealWorldStreetsMovement extends AbstractLocalMovementStrategy {
trajectory = new RouteImpl(comp.getRealPosition(),
destination, pointList,
routeSensor.getSegmentListeners(), routeSensor,
calculateSegments(rsp.getBest()));
calculateSegments(pointList));
} else {
trajectory = new RouteImpl(comp.getRealPosition(),
destination, pointList);
......
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