minor refinement
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>1.5.16</version>
|
||||
<version>1.5.17</version>
|
||||
<name>Web4Rail</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>Java Model Railway Control</description>
|
||||
|
||||
@@ -448,7 +448,7 @@ public class Route extends BaseClass {
|
||||
LOG.debug("{}.isFreeFor({})",this,train);
|
||||
if (isNull(train.train())) return false;
|
||||
for (Tile tile : path) {
|
||||
if (!tile.isFreeFor(train)) return false;
|
||||
if (!tile.isFreeFor(train) && tile != startBlock) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -798,7 +798,7 @@ public class Route extends BaseClass {
|
||||
context = newContext;
|
||||
for (Tile tile : path) {
|
||||
if (newContext.invalidated() || !tile.reserveFor(newContext)) {
|
||||
LOG.debug("Was not able to allocate route for {}.",newContext);
|
||||
LOG.debug("Was not able to allocate {} for {}.",tile,newContext);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ public abstract class Block extends StretchableTile{
|
||||
Train newTrain = context.train();
|
||||
LOG.debug("{}.lockFor({})",this,newTrain);
|
||||
Train train = lockingTrain();
|
||||
if (newTrain == train || parkedTrains.isEmpty() || parkedTrains.contains(newTrain) || newTrain.isShunting()) return super.lockFor(context, downgrade);
|
||||
if (newTrain == train || parkedTrains.isEmpty() || parkedTrains.contains(newTrain) || this == newTrain.currentBlock() || newTrain.isShunting()) return super.lockFor(context, downgrade);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ public abstract class Block extends StretchableTile{
|
||||
Train newTrain = context.train();
|
||||
LOG.debug("{}.lockFor({})",this,newTrain);
|
||||
Train train = lockingTrain();
|
||||
if (newTrain == train || parkedTrains.isEmpty() || parkedTrains.contains(newTrain) || newTrain.isShunting()) return super.reserveFor(context);
|
||||
if (newTrain == train || parkedTrains.isEmpty() || parkedTrains.contains(newTrain) || this == newTrain.currentBlock() || newTrain.isShunting()) return super.reserveFor(context);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ public abstract class Tile extends BaseClass implements Comparable<Tile> {
|
||||
return true; // already locked!
|
||||
}
|
||||
if (isSet(occupyingTrain)) {
|
||||
if (occupyingTrain != newTrain && !newTrain.isShunting()) return debug("{} already occupied by {}",this,occupyingTrain);
|
||||
if (occupyingTrain != newTrain && this != newTrain.currentBlock() && !newTrain.isShunting()) return debug("{} already occupied by {}",this,occupyingTrain);
|
||||
lockingTrain = newTrain;
|
||||
if (!downgrade) return true;
|
||||
}
|
||||
@@ -430,7 +430,7 @@ public abstract class Tile extends BaseClass implements Comparable<Tile> {
|
||||
return true; // do not downgrade!
|
||||
}
|
||||
if (isSet(occupyingTrain)) {
|
||||
if (occupyingTrain != newTrain && !newTrain.isShunting()) return debug("{} already occupied by {}",this,occupyingTrain);
|
||||
if (occupyingTrain != newTrain && newTrain.currentBlock() != this && !newTrain.isShunting()) return debug("{} already occupied by {}",this,occupyingTrain);
|
||||
return true; // do not downgrade!
|
||||
}
|
||||
reservingTrain = newTrain;
|
||||
|
||||
Reference in New Issue
Block a user