public void dispatchNewTrain(int trainId, TrainModel newTrain, double speed, int authority) { //Console.WriteLine("dispatching train!!!!!"); Train newT = new Train(trainId, speed, authority); newT.currBlock = newTrain.getCurrBlock(); double speedLimit = TrainSimulation.trackModelWindow.findBlock(newT.currBlock).speedLimit; if (speedLimit < speed) { TrainSimulation.trackModelWindow.dispatchTrain(trainId, newTrain, speedLimit, authority); } else { TrainSimulation.trackModelWindow.dispatchTrain(trainId, newTrain, speed, authority); } trainTrackings.Add(newT); activeTrains.Add(newTrain); TrainSimulation.trackControllerWindow.updateTrains(); }