Do not print derailed trains when setting switch

This commit is contained in:
Arne Keller 2020-02-18 14:50:01 +01:00
parent fa62ba267f
commit 618cee8e70

View File

@ -93,7 +93,7 @@ public class ModelRailwaySimulation {
public boolean setSwitch(final int id, final Vector2D position) { public boolean setSwitch(final int id, final Vector2D position) {
boolean success = railNetwork.setSwitch(id, position); boolean success = railNetwork.setSwitch(id, position);
if (success) { if (success) {
// derail trains on switch TODO: await forum answer on printing derailed trains // derail trains on switch, explicitly not (!) printing any removed trains (source: forum post)
trains.values().stream().filter(train -> train.isOnRail(id)).forEach(Train::removeFromRails); trains.values().stream().filter(train -> train.isOnRail(id)).forEach(Train::removeFromRails);
} }
return success; return success;