diff --git a/Car.py b/Car.py index 9f05feb..f72689e 100644 --- a/Car.py +++ b/Car.py @@ -168,15 +168,15 @@ class Car(): if(ind == -1): continue conn[ind] = c - cars = None + cars = [] for i,f in enumerate(reversed(resp)): if(f == '0'): continue edge = conn[i].getFrom() - cars = self.controller.getCarsOnLane(edge.getID(), conn[i].getFromLane().getIndex()) - if(cars is None): - return - cars = list(cars) + cars += list(self.controller.getCarsOnLane(edge.getID(), conn[i].getFromLane().getIndex())) # doit y avoir moyen de le faire en gardant les filters, flemme + intLane = self.map.getLane(conn[i].getViaLaneID()) + intEdge = intLane.getEdge() + cars += list(self.controller.getCarsOnLane(intEdge.getID(), intLane.getIndex())) if(len(cars) == 0): return None return cars[0] # TODO: récuperer la voiture la plus proche au lieu d'un au hasard