This commit is contained in:
Stephan Richter
2020-11-06 01:49:34 +01:00
parent ead5a45d2e
commit 9190d8a6af
7 changed files with 47 additions and 28 deletions

View File

@@ -99,6 +99,9 @@ public abstract class Block extends StretchableTile{
Train newTrain = Train.get(trainId);
if (isSet(newTrain) && newTrain != train) {
newTrain.dropTrace();
if (connections(newTrain.direction()).isEmpty()) {
newTrain.heading(null);
}
newTrain.set(this);
}
}

View File

@@ -216,12 +216,17 @@ public abstract class Tile extends BaseClass{
Window window = new Window("tile-properties",t("Properties of {} @ ({},{})",title(),x,y));
if (isSet(train)) {
window.children().insertElementAt(new Button(t("stop"),"train("+train.id+",'"+ACTION_STOP+"')"), 1);
window.children().insertElementAt(new Button(t("start"),"train("+train.id+",'"+ACTION_START+"')"), 1);
HashMap<String, Object> props = new HashMap<String,Object>(Map.of(REALM,REALM_TRAIN,ID,train.id));
props.put(ACTION, ACTION_STOP);
window.children().insertElementAt(new Button(t("stop"),props), 1);
props.put(ACTION, ACTION_START);
window.children().insertElementAt(new Button(t("start"),props), 1);
window.children().insertElementAt(train.link("span"), 1);
window.children().insertElementAt(new Tag("h4").content(t("Train:")), 1);
}
if (isSet(route)) link("p",Map.of(REALM,REALM_ROUTE,ID,route.id(),ACTION,ACTION_PROPS),t("Locked by {}",route)).addTo(window);
Form form = propForm("tile-properties-"+id());
new Tag("h4").content(t("Length")).addTo(form);
new Input(LENGTH,length).numeric().addTo(new Label(t("Length")+":"+NBSP)).addTo(form);
@@ -230,9 +235,6 @@ public abstract class Tile extends BaseClass{
new Button(t("Apply"),form).addTo(form);
form.addTo(window);
if (isSet(route)) {
new Tag("p").content(t("Locked by {}",route)).addTo(window);
}
if (!routes.isEmpty()) {
new Tag("h4").content(t("Routes using this tile:")).addTo(window);