bugfixes
This commit is contained in:
@@ -200,9 +200,7 @@ public abstract class Block extends StretchableTile{
|
||||
@Override
|
||||
protected HashSet<String> classes() {
|
||||
HashSet<String> classes = super.classes();
|
||||
if (!isNull(occupyingTrain()) || !parkedTrains.isEmpty()) classes.add(OCCUPIED);
|
||||
if (!isNull(lockingTrain())) classes.add(LOCKED);
|
||||
if (isDisabled()) classes.add(DISABLED);
|
||||
if (!parkedTrains.isEmpty()) classes.add(OCCUPIED);
|
||||
return classes;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ public abstract class Tile extends BaseClass implements Comparable<Tile> {
|
||||
if (isSet(reservingTrain)) classes.add(RESERVED);
|
||||
if (isSet(lockingTrain)) classes.add(LOCKED);
|
||||
if (isSet(occupyingTrain)) classes.add(OCCUPIED);
|
||||
if (disabled) classes.add(DISABLED);
|
||||
return classes;
|
||||
}
|
||||
|
||||
@@ -554,6 +555,7 @@ public abstract class Tile extends BaseClass implements Comparable<Tile> {
|
||||
if (isSet(len)) length(Integer.parseInt(len));
|
||||
super.update(params);
|
||||
plan.place(this);
|
||||
plan.alter();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -162,10 +162,16 @@ public abstract class Turnout extends Tile implements Device{
|
||||
public Reply state(State newState,boolean shift) {
|
||||
Train lockingTrain = lockingTrain();
|
||||
|
||||
if (isSet(lockingTrain)) {
|
||||
if (newState != state && !shift) return new Reply(415, t("{} locked by {}!",this,lockingTrain));
|
||||
// shift allows to switch locked turnouts...
|
||||
} else if (shift) return new Reply(200,"OK"); // shift on a non-locked turnout skips the switch process
|
||||
if (isDisabled()) {
|
||||
// shift allows to switch disabled turnouts...
|
||||
if (newState != state && !shift) return new Reply(415, t("{} is disabled!",this));
|
||||
} else {
|
||||
if (isSet(lockingTrain)) {
|
||||
// shift allows to switch locked turnouts...
|
||||
if (newState != state && !shift) return new Reply(415, t("{} locked by {}!",this,lockingTrain));
|
||||
|
||||
} else if (shift) return new Reply(200,"OK"); // shift on a non-locked turnout skips the switch process
|
||||
}
|
||||
if (address == 0) {
|
||||
sleep(300);
|
||||
state = newState;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import de.srsoftware.web4rail.Command.Reply;
|
||||
import de.srsoftware.web4rail.tags.Fieldset;
|
||||
import de.srsoftware.web4rail.tags.Input;
|
||||
import de.srsoftware.web4rail.tags.Window;
|
||||
@@ -15,7 +16,8 @@ public abstract class TurnoutL extends Turnout {
|
||||
@Override
|
||||
public Object click(boolean shift) throws IOException {
|
||||
Object o = super.click(shift);
|
||||
state(state == State.STRAIGHT ? State.LEFT : State.STRAIGHT,shift);
|
||||
Reply reply = state(state == State.STRAIGHT ? State.LEFT : State.STRAIGHT,shift);
|
||||
if (!reply.succeeded()) plan.stream(reply.message());
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user