implemented pre-reservation of routes when autopilot is active

This commit is contained in:
Stephan Richter
2020-11-27 15:04:31 +01:00
parent 5e54c0cfb6
commit dec68728ad
12 changed files with 178 additions and 55 deletions

View File

@@ -122,7 +122,7 @@ public abstract class Block extends StretchableTile implements Comparable<Block>
@Override
public Object click() throws IOException {
if (isSet(train)) return train.props();
if (isSet(train)) return train.properties();
return super.click();
}
@@ -165,13 +165,13 @@ public abstract class Block extends StretchableTile implements Comparable<Block>
return null;
}
public Range getWaitTime(Train train) {
public Range getWaitTime(Train train,Direction dir) {
for (WaitTime wt : waitTimes) {
if (train.tags().contains(wt.tag)) {
return wt.get(train.direction());
}
}
return getWaitTime(NO_TAG).get(train.direction());
return getWaitTime(NO_TAG).get(dir);
}
@Override

View File

@@ -118,7 +118,7 @@ public abstract class Tile extends BaseClass{
public boolean isFreeFor(Train newTrain) {
if (disabled) return false;
if (isSet(route)) return false;
if (isSet(route) && route.train != newTrain) return false;
if (isSet(train) && train != newTrain) return false;
return true;
}