cleanup: consolidate to a single isIndestructible() predicate
This commit is contained in:
parent
89e1b04f95
commit
6ccc6339fc
2 changed files with 8 additions and 11 deletions
|
@ -157,7 +157,7 @@ class MapScanner extends TileBehavior
|
||||||
if (!city.testBounds(x, y)) {
|
if (!city.testBounds(x, y)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isIndestructible2(city.getTile(x,y))) {
|
if (isIndestructible(city.getTile(x,y))) {
|
||||||
// radioactive, on fire, or flooded
|
// radioactive, on fire, or flooded
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -421,8 +421,11 @@ class MapScanner extends TileBehavior
|
||||||
if (isAnimated(thCh))
|
if (isAnimated(thCh))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (isRubble(thCh))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!isIndestructible(thCh))
|
if (!isIndestructible(thCh))
|
||||||
{ //not rubble, radiactive, on fire or flooded
|
{ //not radiactive, on fire or flooded
|
||||||
|
|
||||||
city.setTile(xx,yy,(char) ts.tileNumber);
|
city.setTile(xx,yy,(char) ts.tileNumber);
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,19 +291,13 @@ public class TileConstants
|
||||||
return spec != null && spec.canConduct;
|
return spec != null && spec.canConduct;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Used in repairZone(). */
|
/** Used in repairZone, zonePlop().
|
||||||
|
* @return true if the tile is flood, fire, or radioactive fall-out.
|
||||||
|
*/
|
||||||
public static boolean isIndestructible(int tile)
|
public static boolean isIndestructible(int tile)
|
||||||
{
|
{
|
||||||
assert (tile & LOMASK) == tile;
|
assert (tile & LOMASK) == tile;
|
||||||
|
|
||||||
return tile >= RUBBLE && tile < ROADBASE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Used in zonePlop(). */
|
|
||||||
public static boolean isIndestructible2(int tile)
|
|
||||||
{
|
|
||||||
assert (tile & LOMASK) == tile;
|
|
||||||
|
|
||||||
return tile >= FLOOD && tile < ROADBASE;
|
return tile >= FLOOD && tile < ROADBASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue