From 200c06bfaca5054dd7245a963a17376648f03999 Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Mon, 11 Jan 2021 01:53:31 +0300 Subject: [PATCH] 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. --- src/MakkahCity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MakkahCity.java b/src/MakkahCity.java index aa474bc..2527f18 100644 --- a/src/MakkahCity.java +++ b/src/MakkahCity.java @@ -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();