diff --git a/src/micropolisj/engine/Bulldozer.java b/src/micropolisj/engine/Bulldozer.java index 8194033..7700031 100644 --- a/src/micropolisj/engine/Bulldozer.java +++ b/src/micropolisj/engine/Bulldozer.java @@ -26,10 +26,10 @@ class Bulldozer extends ToolStroke for (int y = 0; y < b.height; y++) { for (int x = 0; x < b.width; x++) { - int tile = eff.getTile(b.x+x, b.y+y); - if (isDozeable(tile) && !isZoneCenter(tile)) { + ToolEffectIfc subEff = new TranslatedToolEffect(eff, b.x+x, b.y+y); + if (city.isTileDozeable(subEff)) { - dozeField(new TranslatedToolEffect(eff, b.x+x, b.y+y)); + dozeField(subEff); } } @@ -81,9 +81,6 @@ class Bulldozer extends ToolStroke { int tile = eff.getTile(0, 0); - // check dozeable bit - assert isDozeable(tile); - if (isOverWater(tile)) { // dozing over water, replace with water. diff --git a/src/micropolisj/engine/Micropolis.java b/src/micropolisj/engine/Micropolis.java index 3a3530a..9c13fd5 100644 --- a/src/micropolisj/engine/Micropolis.java +++ b/src/micropolisj/engine/Micropolis.java @@ -428,6 +428,32 @@ public class Micropolis return map[ypos][xpos]; } + boolean isTileDozeable(ToolEffectIfc eff) + { + int myTile = eff.getTile(0, 0) & LOMASK; + TileSpec ts = Tiles.get(myTile); + if (ts.canBulldoze) { + return true; + } + + if (ts.owner != null) { + // part of a zone; only bulldozeable if the owner tile is + // no longer intact. + + int baseTile = eff.getTile(-ts.ownerOffsetX, -ts.ownerOffsetY) & LOMASK; + return !(ts.owner.tileNumber == baseTile); + } + + return false; + } + + boolean isTileDozeable(int xpos, int ypos) + { + return isTileDozeable( + new ToolEffect(this, xpos, ypos) + ); + } + public boolean isTilePowered(int xpos, int ypos) { return (getTile(xpos, ypos) & PWRBIT) == PWRBIT; @@ -2018,7 +2044,7 @@ public class Micropolis if (isCombustible(z)) { z |= 8192; //synthesize BURNBIT on export } - if (isDozeable(z)) { + if (isTileDozeable(x, y)) { z |= 4096; //synthesize BULLBIT on export } if (isAnimated(z)) {