From 6ccc6339fcb8cbd3a88dbd94ee15edaa4fa5dce3 Mon Sep 17 00:00:00 2001 From: Jason Long Date: Sun, 21 Sep 2014 15:34:06 -0400 Subject: [PATCH] cleanup: consolidate to a single isIndestructible() predicate --- src/micropolisj/engine/MapScanner.java | 7 +++++-- src/micropolisj/engine/TileConstants.java | 12 +++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/micropolisj/engine/MapScanner.java b/src/micropolisj/engine/MapScanner.java index b79db8d..85ffae8 100644 --- a/src/micropolisj/engine/MapScanner.java +++ b/src/micropolisj/engine/MapScanner.java @@ -157,7 +157,7 @@ class MapScanner extends TileBehavior if (!city.testBounds(x, y)) { return false; } - if (isIndestructible2(city.getTile(x,y))) { + if (isIndestructible(city.getTile(x,y))) { // radioactive, on fire, or flooded return false; } @@ -421,8 +421,11 @@ class MapScanner extends TileBehavior if (isAnimated(thCh)) continue; + if (isRubble(thCh)) + continue; + if (!isIndestructible(thCh)) - { //not rubble, radiactive, on fire or flooded + { //not radiactive, on fire or flooded city.setTile(xx,yy,(char) ts.tileNumber); } diff --git a/src/micropolisj/engine/TileConstants.java b/src/micropolisj/engine/TileConstants.java index 7d5f182..c5c50cf 100644 --- a/src/micropolisj/engine/TileConstants.java +++ b/src/micropolisj/engine/TileConstants.java @@ -291,19 +291,13 @@ public class TileConstants 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) { 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; }