This commit is contained in:
Stephan Richter
2020-12-10 10:16:21 +01:00
parent 68f08f012f
commit 1b7103ffbd
5 changed files with 11 additions and 2 deletions

View File

@@ -406,6 +406,10 @@ public class Route extends BaseClass {
return win;
}
public Context context() {
return context.clone();
}
public Block endBlock() {
return endBlock;
}

View File

@@ -274,6 +274,7 @@ public abstract class Block extends StretchableTile{
Id trainId = Id.from(params,Train.class.getSimpleName());
if (trainId.equals(0)) { // TODO: this is rubbish
if (isSet(train)) train.dropTrace();
train.set(null);
train = null;
} else {
Train newTrain = Train.get(trainId);

View File

@@ -75,12 +75,15 @@ public class Contact extends Tile{
LOG.debug("{} activated.",this);
state = true;
if (isSet(timer)) timer.abort();
Context context = null;
if (isSet(route)) {
context = route.context();
route.contact(this);
} else if (getClass() != Contact.class) {
plan.warn(this);
}
actions.fire(new Context(this));
if (isNull(context)) context = new Context(this);
actions.fire(context);
stream();
}
}