bugfixes, added debug output

This commit is contained in:
Stephan Richter
2020-12-18 14:12:22 +01:00
parent 8fb23eec1a
commit 6d9a4d9120
12 changed files with 158 additions and 57 deletions

View File

@@ -67,6 +67,7 @@ public class ActionList extends Action implements Iterable<Action>{
}
public boolean fire(Context context) {
LOG.debug("{}.fire({})",this,context);
if (context.invalidated()) {
LOG.debug("Context has been invalidated, aborting {}",this);
return false;

View File

@@ -25,7 +25,10 @@ public class PreserveRoute extends Action {
if (train.destination() == route.endBlock()) return true;
Range waitTime = route.endBlock().getWaitTime(train,route.endDirection);
if (waitTime.max > 0) return true; // train is expected to wait in next block.
if (waitTime.max > 0) {
LOG.debug("Not preserving route, as train needs to stop in following block!");
return true; // train is expected to wait in next block.
}
train.reserveNext();
return true;