diff --git a/src/micropolisj/engine/MapScanner.java b/src/micropolisj/engine/MapScanner.java index 820921f..af82ad5 100644 --- a/src/micropolisj/engine/MapScanner.java +++ b/src/micropolisj/engine/MapScanner.java @@ -936,10 +936,8 @@ class MapScanner int evalLot(int x, int y) { // test for clear lot - int tmp = city.getTile(x,y) & LOMASK; - - if (tmp != DIRT && (tmp < RESBASE || tmp > RESBASE+8)) - { + int tile = city.getTile(x,y); + if (tile != DIRT && !isResidentialClear(tile)) { return -1; } @@ -952,11 +950,13 @@ class MapScanner int xx = x + DX[z]; int yy = y + DY[z]; - if (city.testBounds(xx, yy) && - city.map[yy][xx] != DIRT && - ((city.map[yy][xx] & LOMASK) <= LASTROAD)) //look for road - { - score++; + // look for road + if (city.testBounds(xx, yy)) { + int tmp = city.getTile(xx, yy); + if (isRoad(tmp) || isRail(tmp)) + { + score++; + } } } diff --git a/src/micropolisj/engine/TileConstants.java b/src/micropolisj/engine/TileConstants.java index 599b76b..071a7b6 100644 --- a/src/micropolisj/engine/TileConstants.java +++ b/src/micropolisj/engine/TileConstants.java @@ -80,7 +80,7 @@ public class TileConstants public static final char LTRFBASE = 80; public static final char BRWV = 95; //vert bridge, open public static final char HTRFBASE = 144; - public static final char LASTROAD = 206; + private static final char LASTROAD = 206; public static final char POWERBASE = 208; public static final char HPOWER = 208; //underwater power-line public static final char VPOWER = 209; @@ -664,6 +664,11 @@ public class TileConstants || (tmp >= SMOKEBASE2 && tmp < FOOTBALLGAME1); } + public static boolean isResidentialClear(int tile) + { + return (tile & LOMASK) >= RESBASE && (tile & LOMASK) <= RESBASE+8; + } + /** Note: does not include hospital/church. * @see #isHospitalOrChurch */