Hello. I'm not really sure on how to explain the problem, but here goes.
I'm creating a Traffic Simulator of a cross junction. I currently have car objects moving, with working traffic lights. I created a variable array for the car class which creates several car objects. Then the lane for the car is randomly chosen, e.g. South road of the junction, left lane or middle lane etc.
I'm now having a problem with trying to identify if there are any cars on a specific lane, if so, then do some stuff, such as stop behind or slow down etc.
I have the classes Traffic, Car and Lane (There are several lane classes, such as SouthLeftLane, SouthMiddleLane). Traffic creates the car objects in the array. Car than chooses a specific lane, in which a Lane class is then called.
I know this may not be a good approach, however I don't know a better one.