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:
parent
300adefd27
commit
275139c2d1
2 changed files with 14 additions and 3 deletions
|
@ -1030,7 +1030,7 @@ class MapScanner
|
||||||
|
|
||||||
private void doCommercialIn(int pop, int value)
|
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)
|
if (pop > z)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1235,7 +1235,7 @@ class MapScanner
|
||||||
if (traf < 0)
|
if (traf < 0)
|
||||||
return -3000;
|
return -3000;
|
||||||
|
|
||||||
int value = city.landValueMem[ypos/2][xpos/2];
|
int value = city.getLandValue(xpos, ypos);
|
||||||
value -= city.pollutionMem[ypos/2][xpos/2];
|
value -= city.pollutionMem[ypos/2][xpos/2];
|
||||||
|
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
|
@ -1257,7 +1257,7 @@ class MapScanner
|
||||||
*/
|
*/
|
||||||
int getCRValue()
|
int getCRValue()
|
||||||
{
|
{
|
||||||
int lval = city.landValueMem[ypos/2][xpos/2];
|
int lval = city.getLandValue(xpos, ypos);
|
||||||
lval -= city.pollutionMem[ypos/2][xpos/2];
|
lval -= city.pollutionMem[ypos/2][xpos/2];
|
||||||
|
|
||||||
if (lval < 30)
|
if (lval < 30)
|
||||||
|
|
|
@ -1058,6 +1058,17 @@ public class Micropolis
|
||||||
trfDensity[mapY/2][mapX/2] = z;
|
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)
|
public int getTrafficDensity(int xpos, int ypos)
|
||||||
{
|
{
|
||||||
if (testBounds(xpos, ypos)) {
|
if (testBounds(xpos, ypos)) {
|
||||||
|
|
Reference in a new issue