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

@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.srsoftware</groupId> <groupId>de.srsoftware</groupId>
<artifactId>web4rail</artifactId> <artifactId>web4rail</artifactId>
<version>1.2.25</version> <version>1.2.26</version>
<name>Web4Rail</name> <name>Web4Rail</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<description>Java Model Railway Control</description> <description>Java Model Railway Control</description>

View File

@@ -135,7 +135,8 @@ public abstract class BaseClass implements Constants{
public String toString() { public String toString() {
StringBuffer sb = new StringBuffer(getClass().getSimpleName()); StringBuffer sb = new StringBuffer(getClass().getSimpleName());
sb.append("("); sb.append("(");
sb.append(t("Train: {}",train)); sb.append("main: "+main);
if (isSet(train)) sb.append(", "+t("Train: {}",train));
if (isSet(direction)) sb.append(", "+t("Direction: {}",direction)); if (isSet(direction)) sb.append(", "+t("Direction: {}",direction));
if (isSet(block)) sb.append(", "+t("Block: {}",block)); if (isSet(block)) sb.append(", "+t("Block: {}",block));
if (isSet(route)) sb.append(", "+t("Route: {}",route)); if (isSet(route)) sb.append(", "+t("Route: {}",route));

View File

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

View File

@@ -29,7 +29,7 @@ public class ConditionalAction extends ActionList {
@Override @Override
public boolean fire(Context context) { public boolean fire(Context context) {
for (Condition condition : conditions) { 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. 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 @Override
public boolean fire(Context context) { public boolean fire(Context context) {
if (isNull(context.train())) return false; if (isNull(context.train())) return false;
context.train().quitAutopilot(); if (inverted) {
context.train().automatic();
} else context.train().quitAutopilot();
return true; return true;
} }

View File

@@ -193,7 +193,7 @@ public class Train extends BaseClass implements Comparable<Train> {
car.train(this); car.train(this);
} }
private String automatic() { public String automatic() {
if (isNull(autopilot)) { if (isNull(autopilot)) {
autopilot = new Autopilot(); autopilot = new Autopilot();
autopilot.start(); autopilot.start();