bugfixes
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.srsoftware</groupId>
|
||||
<artifactId>web4rail</artifactId>
|
||||
<version>1.2.21</version>
|
||||
<version>1.2.22</version>
|
||||
<name>Web4Rail</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>Java Model Railway Control</description>
|
||||
|
||||
@@ -88,7 +88,17 @@ public abstract class BaseClass implements Constants{
|
||||
}
|
||||
|
||||
public Context clone() {
|
||||
return new Context(main);
|
||||
Context clone = new Context(main);
|
||||
clone.tile = tile;
|
||||
clone.block = block;
|
||||
clone.train = train;
|
||||
clone.route = route;
|
||||
clone.action = action;
|
||||
clone.condition = condition;
|
||||
clone.car = car;
|
||||
clone.contact = contact;
|
||||
clone.direction = direction;
|
||||
return clone;
|
||||
}
|
||||
|
||||
public Condition condition() {
|
||||
|
||||
@@ -180,7 +180,7 @@ public class ActionList extends Action implements Iterable<Action>{
|
||||
action.remove();
|
||||
return context.properties();
|
||||
case ACTION_MOVE:
|
||||
return action.moveUp() ? action.properties() : t("No action with id {} found!",actionId);
|
||||
return action.moveUp() ? action.context().properties() : t("No action with id {} found!",actionId);
|
||||
case ACTION_PROPS:
|
||||
return action.properties();
|
||||
case ACTION_UPDATE:
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ConditionalAction extends ActionList {
|
||||
@Override
|
||||
public boolean fire(Context context) {
|
||||
for (Condition condition : conditions) {
|
||||
if (!condition.fulfilledBy(context)) return true;
|
||||
if (!condition.fulfilledBy(context)) return false;
|
||||
}
|
||||
return super.fire(context.clone()); // actions, that happen within the conditional action list must not modify the global context.
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class SetContextTrain extends Action {
|
||||
LOG.debug("update: {}",params);
|
||||
Id trainId = Id.from(params,Train.class.getSimpleName());
|
||||
if (isSet(trainId)) train = Train.get(trainId);
|
||||
return properties();
|
||||
return super.update(params);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -197,6 +197,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
if (isNull(autopilot)) {
|
||||
autopilot = new Autopilot();
|
||||
autopilot.start();
|
||||
if (isSet(currentBlock)) plan.place(currentBlock);
|
||||
}
|
||||
return t("{} now in auto-mode",this);
|
||||
}
|
||||
@@ -276,7 +277,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
|
||||
public String directedName() {
|
||||
String result = name();
|
||||
if (isSet(autopilot)) result="•"+result;
|
||||
if (isSet(autopilot)) result="℗"+result;
|
||||
if (isNull(direction)) return result;
|
||||
switch (direction) {
|
||||
case NORTH:
|
||||
@@ -560,7 +561,8 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
}
|
||||
if (isSet(autopilot)) {
|
||||
autopilot.stop = true;
|
||||
autopilot = null;
|
||||
autopilot = null;
|
||||
if (isSet(currentBlock)) plan.place(currentBlock);
|
||||
return t("{} stopping at next block.",this);
|
||||
} else return t("autopilot not active.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user