TileConstants: implement isCombustible()

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@725 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
jason@long.name 2013-07-07 13:16:54 +00:00
parent 94dc4ea7be
commit 6406c12c14
5 changed files with 14 additions and 9 deletions

View file

@ -54,7 +54,7 @@ public class ExplosionSprite extends Sprite
int z = city.getTile(xpos, ypos);
int t = z & LOMASK;
if ((z & BURNBIT) == 0 && t != DIRT)
if (!isCombustible(z) && t != DIRT)
return;
if (isZoneCenter(z))
return;

View file

@ -132,7 +132,7 @@ class MapScanner
}
}
if ((cchr & BURNBIT) == 0) //bridge
if (!isCombustible(cchr)) //bridge
{
city.roadTotal += 4;
if (doBridge())
@ -185,7 +185,7 @@ class MapScanner
continue;
int c = city.map[ytem][xtem];
if ((c & BURNBIT) != 0) {
if (isCombustible(c)) {
if (isZoneCenter(c)) {
city.killZone(xtem, ytem, c);
if ((c & LOMASK) > IZB) { //explode
@ -225,7 +225,7 @@ class MapScanner
if (city.testBounds(xx, yy)) {
int c = city.getTile(xx, yy);
int t = c & LOMASK;
if (((c & BURNBIT) != 0) || c == DIRT ||
if (isCombustible(c) || c == DIRT ||
(t >= WOODS5 && t < FLOOD))
{
if (isZoneCenter(c)) {

View file

@ -1815,7 +1815,7 @@ public class Micropolis
if (isZoneCenter(t)) {
continue;
}
if ((t & BURNBIT) != 0 || t == DIRT) {
if (isCombustible(t) || t == DIRT) {
setTile(x, y, RADTILE);
}
}
@ -2187,7 +2187,7 @@ public class Micropolis
int x = PRNG.nextInt(getWidth());
int y = PRNG.nextInt(getHeight());
int tile = map[y][x];
if (!isZoneCenter(tile) && (tile & BURNBIT) != 0)
if (!isZoneCenter(tile) && isCombustible(tile))
{
tile &= LOMASK;
if (tile > 21 && tile < LASTZONE) {

View file

@ -179,7 +179,7 @@ public abstract class Sprite
city.setTile(xpos, ypos, RIVER);
return;
}
if ((z & BURNBIT) == 0) {
if (!isCombustible(z)) {
return; //cannot destroy it
}
if (isZoneCenter(z)) {

View file

@ -294,7 +294,12 @@ public class TileConstants
public static boolean isBridge(int tile)
{
return (((tile & LOMASK) >= ROADBASE && (tile & LOMASK) <= LASTROAD)
&& ((tile & BURNBIT) == 0));
&& !isCombustible(tile));
}
public static boolean isCombustible(int tile)
{
return (tile & BURNBIT) != 0;
}
public static boolean isFire(int tile)
@ -413,7 +418,7 @@ public class TileConstants
static boolean isFloodable(int tile)
{
return (tile == DIRT || ((tile & BULLBIT) != 0 && (tile & BURNBIT) != 0));
return (tile == DIRT || ((tile & BULLBIT) != 0 && isCombustible(tile)));
}
public static boolean isRoad(int tile)