This commit is contained in:
Stephan Richter
2020-12-05 22:54:43 +01:00
parent 00411d4398
commit fd12d2b515
12 changed files with 223 additions and 203 deletions

View File

@@ -240,7 +240,7 @@ public class Relay extends Tile implements Device{
new Tag("option").attr("value","0").content(t("unset")).addTo(select);
for (Relay relay : BaseClass.listElements(Relay.class)) {
if (exclude.contains(relay)) continue;
Tag opt = select.addOption(relay.id, relay);
Tag opt = select.addOption(relay.id(), relay);
if (relay == preselected) opt.attr("selected", "selected");
}
return select;

View File

@@ -55,7 +55,7 @@ public abstract class Tile extends BaseClass implements Comparable<Tile>{
private int length = DEFAUT_LENGTH;
protected Direction oneWay = null;
protected Route route = null;
private TreeSet<Route> routes = new TreeSet<>();
private TreeSet<Route> routes = new TreeSet<>((r1,r2)->r1.toString().compareTo(r2.toString()));
protected Train train = null;
public Integer x = null;
public Integer y = null;
@@ -169,10 +169,11 @@ public abstract class Tile extends BaseClass implements Comparable<Tile>{
}
public Tile load(JSONObject json) {
if (json.has(ID)) json.remove(ID); // id should be created from cordinates
super.load(json);
JSONObject pos = json.getJSONObject(POS);
x = pos.getInt(X);
y = pos.getInt(Y);
y = pos.getInt(Y);
if (json.has(DISABLED)) disabled = json.getBoolean(DISABLED);
if (json.has(LENGTH)) length = json.getInt(LENGTH);
if (json.has(ONEW_WAY)) oneWay = Direction.valueOf(json.getString(ONEW_WAY));