Skip done vehicles:

Skip done cars improves perf greatly.
    Tested in parallel with previous commit
    and results in faster exc when sim has more/less
    generated cars.
This commit is contained in:
HeshamTB 2021-01-11 01:53:31 +03:00
parent 7ffbe689bc
commit 200c06bfac

View File

@ -438,7 +438,7 @@ public class MakkahCity {
clearDoneCivilVehicles();
addCivilVehicleNoise();
for (Vehicle vehicle : listOfVehicles) {
if (vehicle.getRoute() == null)
if (vehicle.getRoute() == null || vehicle.isArrivedToDest())
continue;
Route route = vehicle.getRoute();
double currentLocation = vehicle.getCurrentLocation();
@ -502,7 +502,7 @@ public class MakkahCity {
clearDoneCivilVehicles();
addCivilVehicleNoise();
for (Vehicle vehicle : listOfVehicles) {
if (vehicle.getRoute() == null)
if (vehicle.getRoute() == null || vehicle.isArrivedToDest())
continue;
Route route = vehicle.getRoute();
double currentLocation = vehicle.getCurrentLocation();