refactor: make public getLandValue() method for accessing landValueMem[]

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@863 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
jason@long.name 2013-09-28 16:34:17 +00:00
parent 300adefd27
commit 275139c2d1
2 changed files with 14 additions and 3 deletions

View file

@ -1030,7 +1030,7 @@ class MapScanner
private void doCommercialIn(int pop, int value)
{
int z = city.landValueMem[ypos/2][xpos/2] / 32;
int z = city.getLandValue(xpos, ypos) / 32;
if (pop > z)
return;
@ -1235,7 +1235,7 @@ class MapScanner
if (traf < 0)
return -3000;
int value = city.landValueMem[ypos/2][xpos/2];
int value = city.getLandValue(xpos, ypos);
value -= city.pollutionMem[ypos/2][xpos/2];
if (value < 0)
@ -1257,7 +1257,7 @@ class MapScanner
*/
int getCRValue()
{
int lval = city.landValueMem[ypos/2][xpos/2];
int lval = city.getLandValue(xpos, ypos);
lval -= city.pollutionMem[ypos/2][xpos/2];
if (lval < 30)

View file

@ -1058,6 +1058,17 @@ public class Micropolis
trfDensity[mapY/2][mapX/2] = z;
}
/** Accessor method for landValueMem overlay. */
public int getLandValue(int xpos, int ypos)
{
if (testBounds(xpos, ypos)) {
return landValueMem[ypos/2][xpos/2];
}
else {
return 0;
}
}
public int getTrafficDensity(int xpos, int ypos)
{
if (testBounds(xpos, ypos)) {