diff --git a/src/micropolisj/engine/Bulldozer.java b/src/micropolisj/engine/Bulldozer.java index 003fc2b..be97228 100644 --- a/src/micropolisj/engine/Bulldozer.java +++ b/src/micropolisj/engine/Bulldozer.java @@ -47,7 +47,7 @@ class Bulldozer extends ToolStroke assert isZoneCenter(currTile); eff.spend(1); - switch (checkSize(currTile)) + switch (getZoneSizeFor(currTile)) { case 3: eff.makeSound(0, 0, Sound.EXPLOSION_HIGH); @@ -108,28 +108,4 @@ class Bulldozer extends ToolStroke } fixBorder(eff, w, h); } - - int checkSize(int tile) - { - tile = tile & LOMASK; - if ((tile >= (RESBASE-1) && tile <= (PORTBASE-1)) || - (tile >= (LASTPOWERPLANT+1) && tile <= (POLICESTATION+4))) - { - return 3; - } - else if ((tile >= PORTBASE && tile <= LASTPORT) || - (tile >= COALBASE && tile <= LASTPOWERPLANT) || - (tile >= STADIUMBASE && tile <= LASTZONE)) - { - return 4; - } - else if (tile == TileConstants.AIRPORT) - { - return 6; - } - else - { - return 0; - } - } } diff --git a/src/micropolisj/engine/TileConstants.java b/src/micropolisj/engine/TileConstants.java index 7068f99..74a1da7 100644 --- a/src/micropolisj/engine/TileConstants.java +++ b/src/micropolisj/engine/TileConstants.java @@ -426,15 +426,27 @@ public class TileConstants public static int getZoneSizeFor(int tile) { int ch = tile & LOMASK; - if (ch < PORTBASE) { + if (ch >= RESBASE && ch < PORTBASE) { return 3; } - else if (ch == AIRPORT) { + else if (ch >= PORTBASE && ch <= LASTPORT) { + return 4; + } + else if (ch >= AIRPORTBASE && ch < COALBASE) { return 6; } - else { + else if (ch >= COALBASE && ch <= LASTPOWERPLANT) { return 4; } + else if (ch >= FIRESTBASE && ch < STADIUMBASE) { + return 3; + } + else if (ch >= STADIUMBASE && ch <= LASTZONE) { + return 4; + } + else { + return 0; + } } public static boolean isConstructed(int tile)