implemented correct behaviour of Train.stopNow
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -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.3.55</version>
|
<version>1.3.56</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>
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ public class Route extends BaseClass {
|
|||||||
|
|
||||||
private void free() {
|
private void free() {
|
||||||
for (Tile tile : path) {
|
for (Tile tile : path) {
|
||||||
if (train.onTrace(tile)) {
|
if (isSet(train) && train.onTrace(tile)) {
|
||||||
tile.setState(Status.OCCUPIED, train);
|
tile.setState(Status.OCCUPIED, train);
|
||||||
} else tile.free();
|
} else tile.free();
|
||||||
}
|
}
|
||||||
@@ -746,8 +746,8 @@ public class Route extends BaseClass {
|
|||||||
|
|
||||||
public boolean reset() {
|
public boolean reset() {
|
||||||
LOG.debug("{}.reset()",this);
|
LOG.debug("{}.reset()",this);
|
||||||
|
free();
|
||||||
// TODO
|
train = null;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -932,7 +932,11 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
|
|
||||||
public Object stopNow() {
|
public Object stopNow() {
|
||||||
setSpeed(0);
|
setSpeed(0);
|
||||||
listeners.forEach(listener -> listener.on(Listener.Signal.STOP));
|
listeners.forEach(listener -> listener.on(Listener.Signal.STOP)); // abort PathFinder
|
||||||
|
if (isSet(route)) {
|
||||||
|
route.reset();
|
||||||
|
route = null;
|
||||||
|
}
|
||||||
return properties();
|
return properties();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class Contact extends Tile{
|
|||||||
state = true;
|
state = true;
|
||||||
if (isSet(timer)) timer.abort();
|
if (isSet(timer)) timer.abort();
|
||||||
Context context = new Context(this);
|
Context context = new Context(this);
|
||||||
if (isSet(train)) {
|
if (isSet(train())) {
|
||||||
train.contact(this);
|
train.contact(this);
|
||||||
context.train(train);
|
context.train(train);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user