bugfix
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>0.10.1</version>
|
<version>0.10.2</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>
|
||||||
|
|||||||
@@ -342,7 +342,10 @@ public class Route extends BaseClass{
|
|||||||
setSignals(Signal.STOP);
|
setSignals(Signal.STOP);
|
||||||
for (Tile tile : path) tile.setRoute(null);
|
for (Tile tile : path) tile.setRoute(null);
|
||||||
Tile lastTile = path.lastElement();
|
Tile lastTile = path.lastElement();
|
||||||
if (lastTile instanceof Contact) lastTile.set(null);
|
if (lastTile instanceof Contact) {
|
||||||
|
lastTile.set(null);
|
||||||
|
train.removeFromTrace(lastTile);
|
||||||
|
}
|
||||||
train.set(endBlock);
|
train.set(endBlock);
|
||||||
train.heading(endDirection.inverse());
|
train.heading(endDirection.inverse());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -589,6 +589,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
|
|
||||||
public void showTrace() {
|
public void showTrace() {
|
||||||
int remainingLength = length();
|
int remainingLength = length();
|
||||||
|
if (remainingLength<1) remainingLength=1;
|
||||||
for (int i=0; i<trace.size(); i++) {
|
for (int i=0; i<trace.size(); i++) {
|
||||||
Tile tile = trace.get(i);
|
Tile tile = trace.get(i);
|
||||||
if (remainingLength>0) {
|
if (remainingLength>0) {
|
||||||
@@ -605,4 +606,9 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
public void dropTrace() {
|
public void dropTrace() {
|
||||||
while (!trace.isEmpty()) trace.removeFirst().set(null);
|
while (!trace.isEmpty()) trace.removeFirst().set(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeFromTrace(Tile tile) {
|
||||||
|
trace.remove(tile);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,12 +102,13 @@ public abstract class Block extends StretchableTile{
|
|||||||
if (params.containsKey(Train.HEAD)) {
|
if (params.containsKey(Train.HEAD)) {
|
||||||
int trainId = Integer.parseInt(params.get(Train.HEAD));
|
int trainId = Integer.parseInt(params.get(Train.HEAD));
|
||||||
if (trainId == 0) {
|
if (trainId == 0) {
|
||||||
|
if (isSet(train)) train.dropTrace();
|
||||||
train = null;
|
train = null;
|
||||||
} else {
|
} else {
|
||||||
Train dummy = Train.get(trainId);
|
Train newTrain = Train.get(trainId);
|
||||||
if (isSet(dummy) && dummy != train) {
|
if (isSet(newTrain) && newTrain != train) {
|
||||||
dummy.set(this);
|
newTrain.set(this);
|
||||||
dummy.dropTrace();
|
newTrain.dropTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user