cleanup: isOverWater() should neutralize traffic, not the caller

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@684 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
jason@long.name 2013-05-28 01:55:25 +00:00
parent 599ea026f3
commit c272e200bf
2 changed files with 8 additions and 6 deletions

View file

@ -75,8 +75,7 @@ class Bulldozer extends ToolStroke
// check dozeable bit // check dozeable bit
assert isDozeable(tile); assert isDozeable(tile);
tile = neutralizeRoad(tile); if (isOverWater(tile))
if (isOverWater((char)tile))
{ {
// dozing over water, replace with water. // dozing over water, replace with water.
eff.setTile(0, 0, RIVER); eff.setTile(0, 0, RIVER);

View file

@ -76,9 +76,9 @@ public class TileConstants
public static final char INTERSECTION = 76; public static final char INTERSECTION = 76;
public static final char HROADPOWER = 77; public static final char HROADPOWER = 77;
public static final char VROADPOWER = 78; public static final char VROADPOWER = 78;
public static final char BRWH = 79; public static final char BRWH = 79; //horz bridge, open
public static final char LTRFBASE = 80; public static final char LTRFBASE = 80;
public static final char BRWV = 95; public static final char BRWV = 95; //vert bridge, open
public static final char HTRFBASE = 144; public static final char HTRFBASE = 144;
public static final char LASTROAD = 206; public static final char LASTROAD = 206;
public static final char POWERBASE = 208; public static final char POWERBASE = 208;
@ -309,9 +309,12 @@ public class TileConstants
return (tmp >= RADTILE && tmp < FIREBASE); return (tmp >= RADTILE && tmp < FIREBASE);
} }
public static boolean isOverWater(char cell) public static boolean isOverWater(int tile)
{ {
switch (cell & LOMASK) // Note: BRWV will be converted to BRWH by the following
// function.
int tmp = neutralizeRoad(tile & LOMASK);
switch (tmp)
{ {
case HBRIDGE: case HBRIDGE:
case VBRIDGE: case VBRIDGE: