TileConstants: remove hardcoded tile values from OverlayMapView
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@787 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
9c6e987f65
commit
9e9d1b2e9b
2 changed files with 65 additions and 21 deletions
|
@ -171,10 +171,7 @@ public class TileConstants
|
|||
public static final char TINYEXP = 860;
|
||||
public static final char SOMETINYEXP = 864;
|
||||
public static final char LASTTINYEXP = 867;
|
||||
public static final char COALSMOKE1 = 916;
|
||||
public static final char COALSMOKE2 = 920;
|
||||
public static final char COALSMOKE3 = 924;
|
||||
public static final char COALSMOKE4 = 928;
|
||||
public static final char SMOKEBASE2 = 884;
|
||||
public static final char FOOTBALLGAME1 = 932;
|
||||
public static final char FOOTBALLGAME2 = 940;
|
||||
public static final char VBRDG0 = 948; //draw bridge tiles (vert)
|
||||
|
@ -466,12 +463,24 @@ public class TileConstants
|
|||
return (tile == DIRT || ((tile & BULLBIT) != 0 && isCombustible(tile)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: does not include rail/road tiles.
|
||||
* @see #isRoadAny
|
||||
*/
|
||||
public static boolean isRoad(int tile)
|
||||
{
|
||||
int tmp = tile & LOMASK;
|
||||
return (tmp >= ROADBASE && tmp < POWERBASE);
|
||||
}
|
||||
|
||||
public static boolean isRoadAny(int tile)
|
||||
{
|
||||
int tmp = tile & LOMASK;
|
||||
return (tmp >= ROADBASE && tmp < POWERBASE)
|
||||
|| (tmp == HRAILROAD)
|
||||
|| (tmp == VRAILROAD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the tile is a road that will automatically change to connect to
|
||||
* neighboring roads.
|
||||
|
@ -532,6 +541,14 @@ public class TileConstants
|
|||
return (tmp >= RAILBASE && tmp < RESBASE);
|
||||
}
|
||||
|
||||
public static boolean isRailAny(int tile)
|
||||
{
|
||||
int tmp = tile & LOMASK;
|
||||
return (tmp >= RAILBASE && tmp < RESBASE)
|
||||
|| (tmp == RAILHPOWERV)
|
||||
|| (tmp == RAILVPOWERH);
|
||||
}
|
||||
|
||||
public static boolean isRailDynamic(int tile)
|
||||
{
|
||||
int tmp = tile & LOMASK;
|
||||
|
@ -618,29 +635,38 @@ public class TileConstants
|
|||
|
||||
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;
|
||||
int tmp = tile & LOMASK;
|
||||
return (tmp >= INDBASE && tmp < PORTBASE)
|
||||
|| (tmp >= SMOKEBASE && tmp < TINYEXP)
|
||||
|| (tmp >= SMOKEBASE2 && tmp < FOOTBALLGAME1);
|
||||
}
|
||||
|
||||
/** Note: does not include hospital/church.
|
||||
* @see #isHospitalOrChurch
|
||||
*/
|
||||
public static boolean isResidentialZone(int tile)
|
||||
{
|
||||
assert isZoneCenter(tile);
|
||||
return (tile & LOMASK) < HOSPITAL;
|
||||
return (tile & LOMASK) >= RESBASE &&
|
||||
(tile & LOMASK) < HOSPITAL;
|
||||
}
|
||||
|
||||
// includes hospital/church.
|
||||
public static boolean isResidentialZoneAny(int tile)
|
||||
{
|
||||
int tmp = tile & LOMASK;
|
||||
return (tile >= RESBASE && tile < COMBASE);
|
||||
}
|
||||
|
||||
public static boolean isSpecialZone(int tile)
|
||||
|
@ -649,6 +675,12 @@ public class TileConstants
|
|||
return (tile & LOMASK) >= PORTBASE;
|
||||
}
|
||||
|
||||
/** Tile represents a part of any sort of building. */
|
||||
public static boolean isZoneAny(int tile)
|
||||
{
|
||||
return (tile & LOMASK) >= RESBASE;
|
||||
}
|
||||
|
||||
public static boolean isZoneCenter(int tile)
|
||||
{
|
||||
TileSpec spec = Tiles.get(tile & LOMASK);
|
||||
|
|
Reference in a new issue