Skip to content

Commit

Permalink
Slightly adjust a warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
minhduc0711 committed Nov 29, 2021
1 parent 645eef4 commit 4ddc5b1
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1372,14 +1372,16 @@ public void primDriveRandom(final IScope scope) throws GamaRuntimeException {
)
public void primDrive(final IScope scope) throws GamaRuntimeException {
IAgent vehicle = getCurrentAgent(scope);
if (getFinalTarget(vehicle) == null) {
String msg = String.format("%s is not driving because it has no final target",
IPath path = getCurrentPath(vehicle);
if (path == null) {
String msg = String.format(
"%s is not driving because it has not been assigned a valid path. " +
"The action `compute_path` might have been used with the same source and target node.",
vehicle.getName());
throw GamaRuntimeException.warning(msg, scope);
}
// Initialize the first road
if (getCurrentIndex(vehicle) == -1) {
IPath path = getCurrentPath(vehicle);
setNextRoad(vehicle, (IAgent) path.getEdgeList().get(0));
}
moveAcrossRoads(scope, false, null, null);
Expand Down

0 comments on commit 4ddc5b1

Please sign in to comment.