TileConstants: move tile number comparisons to central location (road numbers)
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@781 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
1c4eb5a346
commit
b4f7e09d74
2 changed files with 63 additions and 46 deletions
|
@ -435,6 +435,60 @@ public class TileConstants
|
|||
return (tmp >= ROADBASE && tmp < POWERBASE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the tile is a road that will automatically change to connect to
|
||||
* neighboring roads.
|
||||
*/
|
||||
public static boolean isRoadDynamic(int tile)
|
||||
{
|
||||
int tmp = neutralizeRoad(tile);
|
||||
return (tmp >= ROADS && tile <= INTERSECTION);
|
||||
}
|
||||
|
||||
public static boolean roadConnectsEast(int tile)
|
||||
{
|
||||
tile = neutralizeRoad(tile);
|
||||
return (((tile == VRAILROAD) ||
|
||||
(tile >= ROADBASE && tile <= VROADPOWER)
|
||||
) &&
|
||||
(tile != VROADPOWER) &&
|
||||
(tile != HRAILROAD) &&
|
||||
(tile != VBRIDGE));
|
||||
}
|
||||
|
||||
public static boolean roadConnectsNorth(int tile)
|
||||
{
|
||||
tile = neutralizeRoad(tile);
|
||||
return (((tile == HRAILROAD) ||
|
||||
(tile >= ROADBASE && tile <= VROADPOWER)
|
||||
) &&
|
||||
(tile != HROADPOWER) &&
|
||||
(tile != VRAILROAD) &&
|
||||
(tile != ROADBASE));
|
||||
}
|
||||
|
||||
public static boolean roadConnectsSouth(int tile)
|
||||
{
|
||||
tile = neutralizeRoad(tile);
|
||||
return (((tile == HRAILROAD) ||
|
||||
(tile >= ROADBASE && tile <= VROADPOWER)
|
||||
) &&
|
||||
(tile != HROADPOWER) &&
|
||||
(tile != VRAILROAD) &&
|
||||
(tile != ROADBASE));
|
||||
}
|
||||
|
||||
public static boolean roadConnectsWest(int tile)
|
||||
{
|
||||
tile = neutralizeRoad(tile);
|
||||
return (((tile == VRAILROAD) ||
|
||||
(tile >= ROADBASE && tile <= VROADPOWER)
|
||||
) &&
|
||||
(tile != VROADPOWER) &&
|
||||
(tile != HRAILROAD) &&
|
||||
(tile != VBRIDGE));
|
||||
}
|
||||
|
||||
public static boolean isRail(int tile)
|
||||
{
|
||||
int tmp = tile & LOMASK;
|
||||
|
|
Reference in a new issue