cleanup: use getTile() instead of direct access where possible

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@901 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
jason@long.name 2013-12-06 16:02:20 +00:00
parent 0d82d3514c
commit c5b6b9db4a

View file

@ -1147,7 +1147,7 @@ public class Micropolis
{ {
for (int my = zy; my <= zy+1; my++) for (int my = zy; my <= zy+1; my++)
{ {
int tile = (map[my][mx] & LOMASK); int tile = getTile(mx, my);
if (tile != DIRT) if (tile != DIRT)
{ {
if (tile < RUBBLE) //natural land features if (tile < RUBBLE) //natural land features
@ -1472,8 +1472,8 @@ public class Micropolis
void mapScanTile(int xpos, int ypos) void mapScanTile(int xpos, int ypos)
{ {
int rawTile = getTileRaw(xpos, ypos); int tile = getTile(xpos, ypos);
String behaviorStr = getTileBehavior(rawTile & LOMASK); String behaviorStr = getTileBehavior(tile);
if (behaviorStr == null) { if (behaviorStr == null) {
return; //nothing to do return; //nothing to do
} }
@ -1583,7 +1583,7 @@ public class Micropolis
{ {
if (testBounds(x,y)) if (testBounds(x,y))
{ {
char loc = (char) (map[y][x] & LOMASK); char loc = getTile(x, y);
if (loc >= LHTHR && loc <= HHTHR) if (loc >= LHTHR && loc <= HHTHR)
count++; count++;
} }
@ -2287,7 +2287,7 @@ public class Micropolis
ArrayList<CityLocation> candidates = new ArrayList<CityLocation>(); ArrayList<CityLocation> candidates = new ArrayList<CityLocation>();
for (int y = 0; y < map.length; y++) { for (int y = 0; y < map.length; y++) {
for (int x = 0; x < map[y].length; x++) { for (int x = 0; x < map[y].length; x++) {
if ((map[y][x] & LOMASK) == NUCLEAR) { if (getTile(x, y) == NUCLEAR) {
candidates.add(new CityLocation(x,y)); candidates.add(new CityLocation(x,y));
} }
} }
@ -2364,7 +2364,7 @@ public class Micropolis
for (int z = 0; z < 300; z++) { for (int z = 0; z < 300; z++) {
int x = PRNG.nextInt(getWidth()); int x = PRNG.nextInt(getWidth());
int y = PRNG.nextInt(getHeight()); int y = PRNG.nextInt(getHeight());
int tile = map[y][x] & LOMASK; int tile = getTile(x, y);
if (isRiverEdge(tile)) if (isRiverEdge(tile))
{ {
for (int t = 0; t < 4; t++) { for (int t = 0; t < 4; t++) {