Skip to content

Commit

Permalink
refactor: use precise wording, as the route switch may still fail
Browse files Browse the repository at this point in the history
  • Loading branch information
hoelger committed Sep 30, 2024
1 parent 4f3f51f commit 80d55b5
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class WeatherWarningApp extends AbstractApplication<VehicleOperatingSyste
/**
* Flag that is set if the route has already been changed.
*/
private boolean routeChanged = false;
private boolean triedToChangeRoute = false;

/**
* This is the speed for the DEN message sent for rerouting.
Expand Down Expand Up @@ -117,8 +117,8 @@ public void onMessageReceived(ReceivedV2xMessage receivedV2xMessage) {

getLog().debug("Handle Environment Warning Message. Processing...");

if (routeChanged) {
getLog().infoSimTime(this, "Route already changed");
if (triedToChangeRoute) {
getLog().infoSimTime(this, "Route change already tried once.");
} else {
reactUponDENMessageChangeRoute(denm);
}
Expand Down Expand Up @@ -259,7 +259,7 @@ private void reactUponDENMessageChangeRoute(Denm denm) {
getLog().infoSimTime(this, "The event occurred on connection with id={}, which is part of vehicle's route with id={}", connection, routeInfo.getId());

circumnavigateAffectedRoad(denm, affectedConnectionId);
routeChanged = true;
triedToChangeRoute = true;
return;
}
}
Expand Down

0 comments on commit 80d55b5

Please sign in to comment.