This commit is contained in:
Stephan Richter
2020-12-05 00:18:55 +01:00
parent aab9fcada4
commit 00411d4398
6 changed files with 9 additions and 6 deletions

View File

@@ -91,7 +91,7 @@ public class ActionList extends Action implements Iterable<Action>{
}
public boolean fire(Context context) {
if (!isEmpty()) LOG.debug(t("Firing {}"),this);
if (!isEmpty()) LOG.debug(t("Firing {}"),actions);
for (Action action : actions) {
if (!action.fire(context)) return false;
}

View File

@@ -29,7 +29,7 @@ public class ConditionalAction extends ActionList {
@Override
public boolean fire(Context context) {
for (Condition condition : conditions) {
if (!condition.fulfilledBy(context)) return false;
if (!condition.fulfilledBy(context)) return true; // wenn die Bedingung nicht erfüllt ist, ist das kein Fehler!
}
return super.fire(context.clone()); // actions, that happen within the conditional action list must not modify the global context.
}

View File

@@ -22,7 +22,9 @@ public class StartStopAuto extends Action {
@Override
public boolean fire(Context context) {
if (isNull(context.train())) return false;
context.train().quitAutopilot();
if (inverted) {
context.train().automatic();
} else context.train().quitAutopilot();
return true;
}