This commit is contained in:
Stephan Richter
2021-03-18 00:57:10 +01:00
parent de19b8594a
commit 9b9c65542c
9 changed files with 27 additions and 25 deletions

View File

@@ -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.3.72</version> <version>1.3.73</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>

View File

@@ -78,21 +78,32 @@ svg.Relay rect{
} }
svg.reserved polygon, svg.reserved polygon,
svg.reserved rect:not(.sig_a):not(.sig_b){ svg.reserved rect{
fill: yellow; fill: yellow;
} }
svg.locked polygon, svg.locked polygon,
svg.locked rect:not(.sig_a):not(.sig_b){ svg.locked rect{
fill: lime; fill: lime;
} }
.occupied .block,
svg.occupied polygon, svg.occupied polygon,
svg.occupied rect:not(.sig_a):not(.sig_b){ svg.occupied rect{
fill: orange; fill: orange;
} }
svg.preview circle,
svg.preview line,
svg.preview polygon,
svg.preview rect{
fill:cyan;
}
svg rect.sig_a,
svg rect.sig_b{
fill: inherit;
}
svg text{ svg text{
font-size: 38px; font-size: 38px;
font-family: sans-serif; font-family: sans-serif;
@@ -365,18 +376,6 @@ textarea.json {
margin-left: 5%; margin-left: 5%;
} }
svg.preview circle,
svg.preview line,
svg.preview polygon,
svg.preview rect{
fill:cyan;
}
svg.preview rect.sig_a,
svg.preview rect.sig_b{
fill: inherit;
}
svg.Block text{ svg.Block text{
fill: black; fill: black;
} }
@@ -431,4 +430,4 @@ svg.Block text{
} }
.Switch.on rect.enabled{ .Switch.on rect.enabled{
fill: forestgreen; fill: forestgreen;
} }

View File

@@ -82,10 +82,6 @@ public class ActionList extends Action implements Iterable<Action>{
public boolean fire(Context context,Object cause) { public boolean fire(Context context,Object cause) {
for (Action action : actions) { for (Action action : actions) {
if (context.invalidated()) {
LOG.debug("Context has been invalidated, aborting {}",this);
return false;
}
LOG.debug("firing \"{}\"",action); LOG.debug("firing \"{}\"",action);
if (!action.fire(context,cause)) { if (!action.fire(context,cause)) {
LOG.warn("{} failed",action); LOG.warn("{} failed",action);

View File

@@ -13,6 +13,7 @@ public class PreserveRoute extends Action {
@Override @Override
public boolean fire(Context context,Object cause) { public boolean fire(Context context,Object cause) {
if (context.invalidated()) return false;
Train train = context.train(); Train train = context.train();
Route route = context.route(); Route route = context.route();
// These are errors: // These are errors:

View File

@@ -35,6 +35,7 @@ public class SetSignal extends Action {
@Override @Override
public boolean fire(Context context,Object cause) { public boolean fire(Context context,Object cause) {
if (context.invalidated()) return false;
if (isNull(signal)) return false; if (isNull(signal)) return false;
return signal.state(state); return signal.state(state);
} }

View File

@@ -27,6 +27,7 @@ public class SetSpeed extends Action{
@Override @Override
public boolean fire(Context context,Object cause) { public boolean fire(Context context,Object cause) {
if (context.invalidated()) return false;
if (isNull(context.train())) return false; if (isNull(context.train())) return false;
context.train().setSpeed(speed); context.train().setSpeed(speed);
return true; return true;

View File

@@ -26,6 +26,7 @@ public class SetTurnout extends Action {
@Override @Override
public boolean fire(Context context,Object cause) { public boolean fire(Context context,Object cause) {
if (context.invalidated()) return false;
if (isNull(turnout)) return false; if (isNull(turnout)) return false;
if (!turnout.state(state).succeeded()) return false; if (!turnout.state(state).succeeded()) return false;
if (turnout.address() == 0) return true; if (turnout.address() == 0) return true;

View File

@@ -570,7 +570,10 @@ public class Train extends BaseClass implements Comparable<Train> {
}); });
if (json.has(BLOCK)) {// do not move this up! during set, other fields will be referenced! if (json.has(BLOCK)) {// do not move this up! during set, other fields will be referenced!
currentBlock = (Block) plan.get(Id.from(json, BLOCK), false); currentBlock = (Block) plan.get(Id.from(json, BLOCK), false);
if (isSet(currentBlock)) currentBlock.add(Train.this, direction); if (isSet(currentBlock)) {
currentBlock.setTrain(Train.this);
currentBlock.add(Train.this, direction);
}
} }
} }
}; };

View File

@@ -41,9 +41,9 @@ public class BrakeProcess extends BaseClass implements Runnable{
lastSpeed = train.speed; lastSpeed = train.speed;
updateDistance(); updateDistance();
if (lastSpeed > targetSpeed) lastSpeed -= 10; if (lastSpeed > targetSpeed) lastSpeed -= 10;
if (lastSpeed < targetSpeed && (ended = true)) lastSpeed = targetSpeed;
if (ended) break; if (ended) break;
if (lastSpeed != train.speed) train.setSpeed(lastSpeed); if (lastSpeed <= targetSpeed && (ended = true)) lastSpeed = targetSpeed;
train.setSpeed(lastSpeed);
} }
} }