cleanup: move tile value comparisons into TileConstants class

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@688 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
jason@long.name 2013-05-28 01:55:58 +00:00
parent f5e1793592
commit 873caa361b
2 changed files with 38 additions and 4 deletions

View file

@ -428,6 +428,39 @@ public class TileConstants
return (tmp >= RAILBASE && tmp < RESBASE);
}
public static boolean isCommercialZone(int tile)
{
assert isZoneCenter(tile);
return (tile & LOMASK) >= COMBASE &&
(tile & LOMASK) < INDBASE;
}
public static boolean isHospitalOrChurch(int tile)
{
assert isZoneCenter(tile);
return (tile & LOMASK) >= HOSPITAL &&
(tile & LOMASK) < COMBASE;
}
public static boolean isIndustrialZone(int tile)
{
assert isZoneCenter(tile);
return (tile & LOMASK) >= INDBASE &&
(tile & LOMASK) < PORTBASE;
}
public static boolean isResidentialZone(int tile)
{
assert isZoneCenter(tile);
return (tile & LOMASK) < HOSPITAL;
}
public static boolean isSpecialZone(int tile)
{
assert isZoneCenter(tile);
return (tile & LOMASK) >= PORTBASE;
}
public static boolean isZoneCenter(int tile)
{
return tile >= 0 && (tile & ZONEBIT) != 0;