cleanup: use new isZoneCenter() check instead of testing for ZONEBIT flag

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@617 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
jason@long.name 2013-05-05 18:52:28 +00:00
parent db0a450076
commit 32d23d16bd
4 changed files with 11 additions and 9 deletions

View file

@ -56,7 +56,7 @@ public class ExplosionSprite extends Sprite
int t = z & LOMASK;
if ((z & BURNBIT) == 0 && t != DIRT)
return;
if ((z & ZONEBIT) != 0)
if (isZoneCenter(z))
return;
city.setTile(xpos, ypos, (char)(FIRE + city.PRNG.nextInt(4) + ANIMBIT));
}

View file

@ -78,7 +78,7 @@ class MapScanner
return;
}
if ((cchr & ZONEBIT) != 0)
if (isZoneCenter(cchr))
{
doZone();
return;
@ -192,7 +192,7 @@ class MapScanner
int c = city.map[ytem][xtem];
if ((c & BURNBIT) != 0) {
if ((c & ZONEBIT) != 0) {
if (isZoneCenter(c)) {
city.killZone(xtem, ytem, c);
if ((c & LOMASK) > IZB) { //explode
city.makeExplosion(xtem, ytem);
@ -234,7 +234,7 @@ class MapScanner
if (((c & BURNBIT) != 0) || c == DIRT ||
(t >= WOODS5 && t < FLOOD))
{
if ((c & ZONEBIT) != 0) {
if (isZoneCenter(c)) {
city.killZone(xx, yy, c);
}
city.setTile(xx, yy, (char)(FLOOD + PRNG.nextInt(3)));
@ -755,8 +755,9 @@ class MapScanner
if (city.testBounds(xx, yy))
{
int thCh = city.map[yy][xx];
if ((thCh & ZONEBIT) != 0)
if (isZoneCenter(thCh)) {
continue;
}
if ((thCh & ANIMBIT) != 0)
continue;

View file

@ -672,7 +672,7 @@ public class Micropolis
for (int y = 0; y < height; y++)
{
char tile = map[y][x];
if ((tile & ZONEBIT) != 0)
if (isZoneCenter(tile))
{
tile &= LOMASK;
int den = computePopDen(x, y, (char)tile) * 8;
@ -1838,8 +1838,9 @@ public class Micropolis
continue;
int t = map[y][x];
if ((t & ZONEBIT) != 0)
if (isZoneCenter(t)) {
continue;
}
if ((t & BURNBIT) != 0 || t == DIRT) {
setTile(x, y, RADTILE);
}
@ -2212,7 +2213,7 @@ public class Micropolis
int x = PRNG.nextInt(getWidth());
int y = PRNG.nextInt(getHeight());
int tile = map[y][x];
if ((tile & ZONEBIT) == 0 && (tile & BURNBIT) != 0)
if (!isZoneCenter(tile) && (tile & BURNBIT) != 0)
{
tile &= LOMASK;
if (tile > 21 && tile < LASTZONE) {

View file

@ -182,7 +182,7 @@ public abstract class Sprite
if ((z & BURNBIT) == 0) {
return; //cannot destroy it
}
if ((z & ZONEBIT) != 0) {
if (isZoneCenter(z)) {
city.killZone(xpos, ypos, z);
if (t > RZB) {
city.makeExplosion(xpos, ypos);