bugfix
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>0.10.1</version>
|
||||
<version>0.10.2</version>
|
||||
<name>Web4Rail</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>Java Model Railway Control</description>
|
||||
|
||||
@@ -342,7 +342,10 @@ public class Route extends BaseClass{
|
||||
setSignals(Signal.STOP);
|
||||
for (Tile tile : path) tile.setRoute(null);
|
||||
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.heading(endDirection.inverse());
|
||||
}
|
||||
|
||||
@@ -589,6 +589,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
|
||||
public void showTrace() {
|
||||
int remainingLength = length();
|
||||
if (remainingLength<1) remainingLength=1;
|
||||
for (int i=0; i<trace.size(); i++) {
|
||||
Tile tile = trace.get(i);
|
||||
if (remainingLength>0) {
|
||||
@@ -605,4 +606,9 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
public void dropTrace() {
|
||||
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)) {
|
||||
int trainId = Integer.parseInt(params.get(Train.HEAD));
|
||||
if (trainId == 0) {
|
||||
if (isSet(train)) train.dropTrace();
|
||||
train = null;
|
||||
} else {
|
||||
Train dummy = Train.get(trainId);
|
||||
if (isSet(dummy) && dummy != train) {
|
||||
dummy.set(this);
|
||||
dummy.dropTrace();
|
||||
Train newTrain = Train.get(trainId);
|
||||
if (isSet(newTrain) && newTrain != train) {
|
||||
newTrain.set(this);
|
||||
newTrain.dropTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user