tiles.rc: let zone population be controlled by tiles.rc
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@800 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
51973f75bd
commit
47963b0011
3 changed files with 65 additions and 62 deletions
|
@ -730,9 +730,8 @@ public class TileConstants
|
|||
*/
|
||||
public static int residentialZonePop(int tile)
|
||||
{
|
||||
tile &= LOMASK;
|
||||
int czDen = ((tile - RZB) / 9) % 4;
|
||||
return czDen * 8 + 16;
|
||||
TileSpec ts = Tiles.get(tile & LOMASK);
|
||||
return ts.getPopulation();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -743,12 +742,8 @@ public class TileConstants
|
|||
*/
|
||||
public static int commercialZonePop(int tile)
|
||||
{
|
||||
tile &= LOMASK;
|
||||
if (tile == COMCLR)
|
||||
return 0;
|
||||
|
||||
int czDen = ((tile - CZB) / 9) % 5 + 1;
|
||||
return czDen;
|
||||
TileSpec ts = Tiles.get(tile & LOMASK);
|
||||
return ts.getPopulation() / 8;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -758,11 +753,7 @@ public class TileConstants
|
|||
*/
|
||||
public static int industrialZonePop(int tile)
|
||||
{
|
||||
tile &= LOMASK;
|
||||
if (tile == INDCLR)
|
||||
return 0;
|
||||
|
||||
int czDen = ((tile - IZB) / 9) % 4 + 1;
|
||||
return czDen;
|
||||
TileSpec ts = Tiles.get(tile & LOMASK);
|
||||
return ts.getPopulation() / 8;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,17 @@ public class TileSpec
|
|||
return images.toArray(new String[0]);
|
||||
}
|
||||
|
||||
public int getPopulation()
|
||||
{
|
||||
String v = getAttribute("population");
|
||||
if (v != null) {
|
||||
return Integer.parseInt(v);
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected void load(String inStr, Properties tilesRc)
|
||||
{
|
||||
Scanner in = new Scanner(inStr);
|
||||
|
|
Reference in a new issue