working on saving and loading of route actions

This commit is contained in:
Stephan Richter
2020-09-21 18:44:55 +02:00
parent 5c67e6089d
commit fa58c33938
11 changed files with 144 additions and 47 deletions

View File

@@ -147,6 +147,7 @@ public abstract class Tile {
JSONObject pos = json.getJSONObject(POS);
x = pos.getInt(X);
y = pos.getInt(Y);
if (json.has(ONEW_WAY)) oneWay = Direction.valueOf(json.getString(ONEW_WAY));
return this;
}
@@ -155,6 +156,10 @@ public abstract class Tile {
plan.place(this);
}
public Plan plan() {
return plan;
}
public Tile plan(Plan plan) {
this.plan = plan;
return this;
@@ -173,8 +178,7 @@ public abstract class Tile {
public Tag propForm() {
Form form = new Form();
new Tag("input").attr("type", "hidden").attr("name","action").attr("value", "update").addTo(form);
new Tag("input").attr("type", "hidden").attr("name","x").attr("value", x).addTo(form);
new Tag("input").attr("type", "hidden").attr("name","y").attr("value", y).addTo(form);
new Tag("input").attr("type", "hidden").attr("name",ID).attr("value", id()).addTo(form);
List<Direction> pd = possibleDirections();
if (!pd.isEmpty()) {