detect rof in internal
This commit is contained in:
parent
9d38c3afab
commit
d7dd8e2fa2
10
Car.py
10
Car.py
@ -168,15 +168,15 @@ class Car():
|
|||||||
if(ind == -1):
|
if(ind == -1):
|
||||||
continue
|
continue
|
||||||
conn[ind] = c
|
conn[ind] = c
|
||||||
cars = None
|
cars = []
|
||||||
for i,f in enumerate(reversed(resp)):
|
for i,f in enumerate(reversed(resp)):
|
||||||
if(f == '0'):
|
if(f == '0'):
|
||||||
continue
|
continue
|
||||||
edge = conn[i].getFrom()
|
edge = conn[i].getFrom()
|
||||||
cars = self.controller.getCarsOnLane(edge.getID(), conn[i].getFromLane().getIndex())
|
cars += list(self.controller.getCarsOnLane(edge.getID(), conn[i].getFromLane().getIndex())) # doit y avoir moyen de le faire en gardant les filters, flemme
|
||||||
if(cars is None):
|
intLane = self.map.getLane(conn[i].getViaLaneID())
|
||||||
return
|
intEdge = intLane.getEdge()
|
||||||
cars = list(cars)
|
cars += list(self.controller.getCarsOnLane(intEdge.getID(), intLane.getIndex()))
|
||||||
if(len(cars) == 0):
|
if(len(cars) == 0):
|
||||||
return None
|
return None
|
||||||
return cars[0] # TODO: récuperer la voiture la plus proche au lieu d'un au hasard
|
return cars[0] # TODO: récuperer la voiture la plus proche au lieu d'un au hasard
|
||||||
|
Loading…
x
Reference in New Issue
Block a user