tiles.rc: re-allow bulldozing dead zones
That is, we allow tiles that belong to zones whose center tile has been destroyed (e.g. from a fire) to be individually bulldozed. This used to be allowed by setting the BULLBIT on those tiles when the center tile is destroyed (see killZone() method) but now that we no longer use BULLBIT, we need to test whether the center tile still exists when deciding if a tile can be bulldozed. git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@896 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
6d7e94bf97
commit
8ce6a1fdd5
2 changed files with 30 additions and 7 deletions
|
@ -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.
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Reference in a new issue