protected int calcDelay(Roaduser ru, int stop, int distance) { // calculate the delay for the drivelane leading to this Junction int start = ru.getDrivelaneStartTime(); int speed = ru.getSpeed(); int min_steps = distance / speed; int num_steps = stop - start; int delay = num_steps - min_steps; ru.addDelay(delay); // System.out.println("Just crossed, and waited:"+delay+" start:"+start+" stop:"+stop+" // dist:"+distance); ru.setDrivelaneStartTime(stop); // then return the delay return delay; }