|
@@ -18,6 +18,7 @@ public class TileMap
|
|
|
private int index = -1;
|
|
|
}
|
|
|
|
|
|
+ private int towns = 0;
|
|
|
private final int width;
|
|
|
private final int height;
|
|
|
private final int[][] tiles;
|
|
@@ -63,6 +64,14 @@ public class TileMap
|
|
|
public void setTile(int x, int y, Tile tile)
|
|
|
{
|
|
|
dirty = true;
|
|
|
+ if(tiles[x][y] == Tiles.TOWN.getId())
|
|
|
+ {
|
|
|
+ towns--;
|
|
|
+ }
|
|
|
+ if(tile == Tiles.TOWN)
|
|
|
+ {
|
|
|
+ towns++;
|
|
|
+ }
|
|
|
tiles[x][y] = tile.getId();
|
|
|
}
|
|
|
|
|
@@ -114,6 +123,11 @@ public class TileMap
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /** Slowly Converts a tile into blocked town.
|
|
|
+ *
|
|
|
+ * @param x the x coordinate of the tile
|
|
|
+ * @param y the y coordinate of the tile
|
|
|
+ */
|
|
|
public void convertTown(int x, int y)
|
|
|
{
|
|
|
TownConverter tc = new TownConverter();
|
|
@@ -121,5 +135,14 @@ public class TileMap
|
|
|
tc.y = y;
|
|
|
townConverters.add(tc);
|
|
|
}
|
|
|
+
|
|
|
+ /** Returns the number of active towns.
|
|
|
+ *
|
|
|
+ * @return the number of active towns
|
|
|
+ */
|
|
|
+ public int getNumberOfTowns()
|
|
|
+ {
|
|
|
+ return towns;
|
|
|
+ }
|
|
|
}
|
|
|
|