diff --git a/pom.xml b/pom.xml
index 858ccbc..185527a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
de.srsoftware
web4rail
- 1.1.4
+ 1.1.5
Web4Rail
jar
Java Model Railway Control
diff --git a/src/main/java/de/srsoftware/web4rail/Plan.java b/src/main/java/de/srsoftware/web4rail/Plan.java
index 157f070..5681802 100644
--- a/src/main/java/de/srsoftware/web4rail/Plan.java
+++ b/src/main/java/de/srsoftware/web4rail/Plan.java
@@ -245,7 +245,7 @@ public class Plan extends BaseClass{
Vector routes = new Vector();
for (Block block : blocks) {
for (Connector con : block.startPoints()) {
- routes.addAll(follow(new Route().begin(block,con.from),con));
+ routes.addAll(follow(new Route().begin(block,con.from.inverse()),con));
}
}
for (Tile tile : tiles.values()) tile.routes().clear();
diff --git a/src/main/java/de/srsoftware/web4rail/Route.java b/src/main/java/de/srsoftware/web4rail/Route.java
index f56f39b..bf916b9 100644
--- a/src/main/java/de/srsoftware/web4rail/Route.java
+++ b/src/main/java/de/srsoftware/web4rail/Route.java
@@ -290,7 +290,7 @@ public class Route extends BaseClass implements Comparable{
path = new Vector();
turnouts = new HashMap<>();
startBlock = block;
- startDirection = from.inverse();
+ startDirection = from;
path.add(block);
return this;
}
diff --git a/src/main/java/de/srsoftware/web4rail/moving/Locomotive.java b/src/main/java/de/srsoftware/web4rail/moving/Locomotive.java
index 543bf10..e7ed328 100644
--- a/src/main/java/de/srsoftware/web4rail/moving/Locomotive.java
+++ b/src/main/java/de/srsoftware/web4rail/moving/Locomotive.java
@@ -283,7 +283,7 @@ public class Locomotive extends Car implements Constants,Device{
}
private void queue() {
- int step = proto.steps * speed / maxSpeed;
+ int step = proto.steps * speed / (maxSpeed == 0 ? 100 : maxSpeed);
plan.queue(new Command("SET {} GL "+address+" "+(reverse?1:0)+" "+step+" "+proto.steps+" "+(f1?1:0)+" "+(f2?1:0)+" "+(f3?1:0)+" "+(f4?1:0)) {
@Override
@@ -303,7 +303,7 @@ public class Locomotive extends Car implements Constants,Device{
LOG.debug(this.detail()+".setSpeed({})",newSpeed);
init();
speed = newSpeed;
- if (speed > maxSpeed()) speed = maxSpeed();
+ if (speed > maxSpeed && maxSpeed > 0) speed = maxSpeed();
if (speed < 0) speed = 0;
queue();
diff --git a/src/main/java/de/srsoftware/web4rail/moving/Train.java b/src/main/java/de/srsoftware/web4rail/moving/Train.java
index 2218805..e7d0b36 100644
--- a/src/main/java/de/srsoftware/web4rail/moving/Train.java
+++ b/src/main/java/de/srsoftware/web4rail/moving/Train.java
@@ -542,30 +542,9 @@ public class Train extends BaseClass implements Comparable {
locoList().addTo(propList);
carList().addTo(propList);
- int ms = maxSpeed();
- if (ms < Integer.MAX_VALUE) new Tag("li").content(t("Max. Speed")+": "+maxSpeed()+NBSP+speedUnit).addTo(propList);
-
- HashMap props = new HashMap(Map.of(REALM,REALM_TRAIN,ID,id));
- if (isSet(currentBlock)) {
- currentBlock.link(currentBlock.toString(),"span").addTo(new Tag("li").content(t("Current location:")+NBSP)).addTo(propList);
- Tag actions = new Tag("li").clazz().content(t("Actions:")+NBSP);
- if (isSet(route)) {
- props.put(ACTION, ACTION_STOP);
- new Button(t("stop"),props).addTo(actions);
- } else {
- props.put(ACTION, ACTION_START);
- new Button(t("start"),props).addTo(actions);
- }
- if (isNull(autopilot)) {
- props.put(ACTION, ACTION_AUTO);
- new Button(t("auto"),props).addTo(actions);
- } else {
- props.put(ACTION, ACTION_QUIT);
- new Button(t("quit autopilot"),props).addTo(actions);
- }
- actions.addTo(propList);
- }
-
+ if (isSet(currentBlock)) currentBlock.link(currentBlock.toString(),"span").addTo(new Tag("li").content(t("Current location:")+NBSP)).addTo(propList);
+ if (isSet(direction)) new Tag("li").content(t("Direction: heading {}",direction)).addTo(propList);
+
Tag dest = new Tag("li").content(t("Destination:")+NBSP);
if (isNull(destination)) {
new Button(t("Select from plan"),"return selectDest("+id+");").addTo(dest);
@@ -578,7 +557,8 @@ public class Train extends BaseClass implements Comparable {
if (isSet(route)) {
link("li", Map.of(REALM,REALM_ROUTE,ID,route.id(),ACTION,ACTION_PROPS), route).addTo(propList);
}
- if (isSet(direction)) new Tag("li").content(t("Direction: heading {}",direction)).addTo(propList);
+ int ms = maxSpeed();
+ if (ms < Integer.MAX_VALUE) new Tag("li").content(t("Max. Speed")+": "+maxSpeed()+NBSP+speedUnit).addTo(propList);
SortedSet allTags = tags();
if (!allTags.isEmpty()) {
@@ -677,6 +657,7 @@ public class Train extends BaseClass implements Comparable {
if (isNull(tile)) return t("Tile {} not known!",dest);
if (tile instanceof Block) {
destination = (Block) tile;
+ automatic();
return t("{} now heading for {}",this,destination);
}
return t("{} is not a block!",tile);
@@ -721,6 +702,7 @@ public class Train extends BaseClass implements Comparable {
public String start() throws IOException {
if (isNull(currentBlock)) return t("{} not in a block",this);
+ if (maxSpeed() == 0) return t("Train has maximum speed of 0 {}, cannot go!",speedUnit);
if (isSet(route)) route.reset(); // reset route previously chosen
Context context = new Context(this);