minor refinement
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.5.16</version>
|
<version>1.5.17</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>
|
||||||
|
|||||||
@@ -448,7 +448,7 @@ public class Route extends BaseClass {
|
|||||||
LOG.debug("{}.isFreeFor({})",this,train);
|
LOG.debug("{}.isFreeFor({})",this,train);
|
||||||
if (isNull(train.train())) return false;
|
if (isNull(train.train())) return false;
|
||||||
for (Tile tile : path) {
|
for (Tile tile : path) {
|
||||||
if (!tile.isFreeFor(train)) return false;
|
if (!tile.isFreeFor(train) && tile != startBlock) return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -798,7 +798,7 @@ public class Route extends BaseClass {
|
|||||||
context = newContext;
|
context = newContext;
|
||||||
for (Tile tile : path) {
|
for (Tile tile : path) {
|
||||||
if (newContext.invalidated() || !tile.reserveFor(newContext)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -398,7 +398,7 @@ public abstract class Block extends StretchableTile{
|
|||||||
Train newTrain = context.train();
|
Train newTrain = context.train();
|
||||||
LOG.debug("{}.lockFor({})",this,newTrain);
|
LOG.debug("{}.lockFor({})",this,newTrain);
|
||||||
Train train = lockingTrain();
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,7 +432,7 @@ public abstract class Block extends StretchableTile{
|
|||||||
Train newTrain = context.train();
|
Train newTrain = context.train();
|
||||||
LOG.debug("{}.lockFor({})",this,newTrain);
|
LOG.debug("{}.lockFor({})",this,newTrain);
|
||||||
Train train = lockingTrain();
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ public abstract class Tile extends BaseClass implements Comparable<Tile> {
|
|||||||
return true; // already locked!
|
return true; // already locked!
|
||||||
}
|
}
|
||||||
if (isSet(occupyingTrain)) {
|
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;
|
lockingTrain = newTrain;
|
||||||
if (!downgrade) return true;
|
if (!downgrade) return true;
|
||||||
}
|
}
|
||||||
@@ -430,7 +430,7 @@ public abstract class Tile extends BaseClass implements Comparable<Tile> {
|
|||||||
return true; // do not downgrade!
|
return true; // do not downgrade!
|
||||||
}
|
}
|
||||||
if (isSet(occupyingTrain)) {
|
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!
|
return true; // do not downgrade!
|
||||||
}
|
}
|
||||||
reservingTrain = newTrain;
|
reservingTrain = newTrain;
|
||||||
|
|||||||
Reference in New Issue
Block a user