+ private AltosSiteMapTile createTile(final Point offset) {
+ final AltosSiteMapTile tile = new AltosSiteMapTile(px_size);
+ mapTiles.put(offset, tile);
+ return tile;
+ }
+ private void finishTileLater(final AltosSiteMapTile tile,
+ final Point offset)
+ {
+ SwingUtilities.invokeLater( new Runnable() {
+ public void run() {
+ addTileAt(tile, offset);
+ tile.setScrollable();
+ }
+ } );
+ }
+
+ private void ensureTilesAround(Point base_offset) {
+ for (int x = -1; x <= 1; x++) {
+ for (int y = -1; y <= 1; y++) {
+ Point offset = new Point(base_offset.x + x, base_offset.y + y);
+ if (mapTiles.containsKey(offset))
+ continue;
+ AltosSiteMapTile tile = createTile(offset);
+ initMap(tile, offset);
+ finishTileLater(tile, offset);
+ }
+ }
+ }
+
+
+ private void addTileAt(AltosSiteMapTile tile, Point offset) {
+ if (Math.abs(offset.x) >= MAX_TILE_DELTA ||
+ Math.abs(offset.y) >= MAX_TILE_DELTA)
+ {
+ System.out.printf("Rocket too far away from pad (tile %d,%d)\n",
+ offset.x, offset.y);
+ return;
+ }
+