@@ 6655,6 6655,21 @@ public class IO
}
/**
+ * Convenience method that returns the tile at a given index. Wraps around
+ * the world if need be.
+ * @param xPos The xlocation
+ * @param yPos The ylocation
+ * @return The tile at that location, or null if the location is not valid
+ */
+ public TILE getTileAt(int xPos, int yPos) {
+ int tileIndex = calculateTileIndex(xPos, yPos);
+ if (tileIndex == -1) {
+ return null;
+ }
+ return tile.get(tileIndex);
+ }
+
+ /**
* Returns the 8 surrounding tiles.
* If some of them are off the map, it returns fewer.
* May be expanded to the 21 tiles cross at one point.