Skip to content

Commit

Permalink
fix treetent puzzle editor (add breaks for switch) (exporter exports
Browse files Browse the repository at this point in the history
  same data that importer expects)
  • Loading branch information
longj6 committed Nov 17, 2023
1 parent deadd83 commit bb38732
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/main/java/edu/rpi/legup/puzzle/treetent/TreeTentCell.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,31 @@ public TreeTentType getType() {
return data;
}

public int getValue() {
switch (data) {
case TREE:
return 1;
case GRASS:
return 2;
case TENT:
return 3;
default:
return 0;
}
}

@Override
public void setType(Element e, MouseEvent m) {
switch (e.getElementName()) {
case "Unknown Tile":
this.data = TreeTentType.UNKNOWN;
break;
case "Tree Tile":
this.data = TreeTentType.TREE;
break;
case "Grass Tile":
this.data = TreeTentType.GRASS;
break;
case "Tent Tile":
this.data = TreeTentType.TENT;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public org.w3c.dom.Element exportCell(Document document, PuzzleElement puzzleEle
TreeTentCell cell = (TreeTentCell) puzzleElement;
Point loc = cell.getLocation();

cellElement.setAttribute("value", String.valueOf(cell.getData()));
cellElement.setAttribute("value", String.valueOf(cell.getValue()));
cellElement.setAttribute("x", String.valueOf(loc.x));
cellElement.setAttribute("y", String.valueOf(loc.y));

Expand Down

0 comments on commit bb38732

Please sign in to comment.