Skip to content

Commit

Permalink
fixes an issue with randomdrive and road without any following roads
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaillandier committed Sep 1, 2021
1 parent 7a576c4 commit 5ea4eaa
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -1328,7 +1328,7 @@ public void primDriveRandom(final IScope scope) throws GamaRuntimeException {

IAgent initNode = null;
// initialize vehicle's location
if (getNextRoad(vehicle) == null) {
if (getCurrentRoad(vehicle) == null) {
IList<IShape> nodes = graph.getVertices();
IShape shape = Queries.closest_to(scope, nodes, vehicle);
initNode = shape.getAgent();
Expand Down Expand Up @@ -1616,6 +1616,7 @@ private void moveAcrossRoads(final IScope scope,
return;
} else if (loc.equals(targetLoc)) { // Intermediate node in path
IAgent newRoad = getNextRoad(vehicle);
if (newRoad == null) return;
GamaPoint srcNodeLoc = (GamaPoint) RoadSkill.getSourceNode(newRoad).getLocation();
boolean violatingOneway = !loc.equals(srcNodeLoc);
// check traffic lights and vehicles coming from other roads
Expand Down

0 comments on commit 5ea4eaa

Please sign in to comment.