diff --git a/src/micropolisj/gui/OverlayMapView.java b/src/micropolisj/gui/OverlayMapView.java index e8e8518..9b300d7 100644 --- a/src/micropolisj/gui/OverlayMapView.java +++ b/src/micropolisj/gui/OverlayMapView.java @@ -316,7 +316,7 @@ public class OverlayMapView extends JComponent { for (int x = minX; x < maxX; x++) { - int tile = engine.getTile(x,y) & LOMASK; + int tile = engine.getTile(x,y); switch (mapState) { case RESIDENTIAL: if (isZoneAny(tile) && @@ -367,16 +367,7 @@ public class OverlayMapView extends JComponent // in the checkPower function if (tile != -1) { - if (tile >= 0 && tile <= LAST_TILE) { - for (int yy = 0; yy < TILE_HEIGHT; yy++) - { - for (int xx = 0; xx < TILE_WIDTH; xx++) - { - img.setRGB(x*TILE_WIDTH+xx,y*TILE_HEIGHT+yy, - tileArrayImage.getRGB(xx,tile*TILE_OFFSET_Y+yy)); - } - } - } + paintTile(img, x, y, tile); } } } @@ -416,6 +407,20 @@ public class OverlayMapView extends JComponent } } + void paintTile(BufferedImage img, int x, int y, int tile) + { + assert tile >= 0; + + for (int yy = 0; yy < TILE_HEIGHT; yy++) + { + for (int xx = 0; xx < TILE_WIDTH; xx++) + { + img.setRGB(x*TILE_WIDTH+xx,y*TILE_HEIGHT+yy, + tileArrayImage.getRGB(xx,tile*TILE_OFFSET_Y+yy)); + } + } + } + Rectangle getViewRect(ConnectedView cv) { Rectangle rawRect = cv.scrollPane.getViewport().getViewRect();