Skip to content

Commit

Permalink
Resizing a level keeps the tile materials
Browse files Browse the repository at this point in the history
  • Loading branch information
Interrupt committed Oct 13, 2020
1 parent 1cc4c17 commit 0ddb8c9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Dungeoneer/src/com/interrupt/dungeoneer/game/Level.java
Original file line number Diff line number Diff line change
Expand Up @@ -1625,6 +1625,9 @@ public Tile getTile(int x, int y)
public void setTile(int x, int y, Tile t) {
if(x >= 0 && x < width && y >= 0 && y < height) {
tiles[x + y * width] = t;

if(t != null)
tileMaterials[x + y * width] = t.materials;
}

if(t != null) {
Expand All @@ -1637,6 +1640,9 @@ public void setTileIfUnlocked(int x, int y, Tile t) {
Tile existing = tiles[x + y * width];
if(existing == null || !existing.isLocked) {
tiles[x + y * width] = t;

if(t != null)
tileMaterials[x + y * width] = t.materials;
}
}

Expand Down

0 comments on commit 0ddb8c9

Please sign in to comment.