tiles: transfer ZONEBIT knowledge to tiles.rc

and synthesize ZONEBIT when saving (for compatibility)

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@740 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
jason@long.name 2013-07-20 21:10:29 +00:00
parent 9bf2e91783
commit 91b3736886
8 changed files with 83 additions and 70 deletions

View file

@ -213,7 +213,7 @@ public class TileConstants
public static final char BURNBIT = 8192; // bit 13 ... is combustible
public static final char BULLBIT = 4096; // bit 12 ... is bulldozable
// bit 11 ... unused
public static final char ZONEBIT = 1024; // bit 10 ... is the special tile for a zone
// bit 10 ... unused
public static final char ALLBITS = 64512; // mask for upper 6 bits
public static final char LOMASK = 1023; //mask for low 10 bits
@ -290,7 +290,7 @@ public class TileConstants
public static boolean isArsonable(int tile)
{
return (
(tile & ZONEBIT) == 0 &&
!isZoneCenter(tile) &&
(tile & LOMASK) >= LHTHR &&
(tile & LOMASK) <= LASTZONE
);
@ -372,7 +372,7 @@ public class TileConstants
int tem2 = tile & LOMASK;
if (tem2 < RESBASE ||
tem2 > LASTZONE ||
(tile & ZONEBIT) != 0
isZoneCenter(tile)
) {
return false;
} else {
@ -473,7 +473,8 @@ public class TileConstants
public static boolean isZoneCenter(int tile)
{
return tile >= 0 && (tile & ZONEBIT) != 0;
TileSpec spec = Tiles.get(tile & LOMASK);
return spec != null && spec.zone;
}
/**