mirror of
https://gitlab.com/arnekeller/kit-programmieren-ws1920-final1.git
synced 2024-11-24 09:24:58 +00:00
Do not print derailed trains when setting switch
This commit is contained in:
parent
fa62ba267f
commit
618cee8e70
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user