cleanup: move res/com/ind Zone Pop() functions to TileConstants
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@687 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
25751e73c4
commit
f5e1793592
3 changed files with 47 additions and 29 deletions
|
@ -778,7 +778,7 @@ class MapScanner
|
||||||
{
|
{
|
||||||
city.comZoneCount++;
|
city.comZoneCount++;
|
||||||
|
|
||||||
int tpop = city.commercialZonePop(cchr9);
|
int tpop = commercialZonePop(cchr);
|
||||||
city.comPop += tpop;
|
city.comPop += tpop;
|
||||||
|
|
||||||
int trafficGood;
|
int trafficGood;
|
||||||
|
@ -890,7 +890,7 @@ class MapScanner
|
||||||
city.indZoneCount++;
|
city.indZoneCount++;
|
||||||
setSmoke(powerOn);
|
setSmoke(powerOn);
|
||||||
|
|
||||||
int tpop = city.industrialZonePop(cchr9);
|
int tpop = industrialZonePop(cchr);
|
||||||
city.indPop += tpop;
|
city.indPop += tpop;
|
||||||
|
|
||||||
int trafficGood;
|
int trafficGood;
|
||||||
|
@ -949,7 +949,7 @@ class MapScanner
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tpop = city.residentialZonePop(cchr9);
|
tpop = residentialZonePop(cchr);
|
||||||
}
|
}
|
||||||
|
|
||||||
city.resPop += tpop;
|
city.resPop += tpop;
|
||||||
|
|
|
@ -1508,32 +1508,6 @@ public class Micropolis
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
// counts the population in a certain type of residential zone
|
|
||||||
// a.k.a. RZPop
|
|
||||||
int residentialZonePop(char tile)
|
|
||||||
{
|
|
||||||
int czDen = ((tile - RZB) / 9) % 4;
|
|
||||||
return czDen * 8 + 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
int commercialZonePop(int tile)
|
|
||||||
{
|
|
||||||
if (tile == COMCLR)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int czDen = ((tile - CZB) / 9) % 5 + 1;
|
|
||||||
return czDen;
|
|
||||||
}
|
|
||||||
|
|
||||||
int industrialZonePop(int tile)
|
|
||||||
{
|
|
||||||
if (tile == INDCLR)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int czDen = ((tile - IZB) / 9) % 4 + 1;
|
|
||||||
return czDen;
|
|
||||||
}
|
|
||||||
|
|
||||||
// called every several cycles; this takes the census data collected in this
|
// called every several cycles; this takes the census data collected in this
|
||||||
// cycle and records it to the history
|
// cycle and records it to the history
|
||||||
//
|
//
|
||||||
|
|
|
@ -445,4 +445,48 @@ public class TileConstants
|
||||||
}
|
}
|
||||||
return (char)tile;
|
return (char)tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the population level of a Residential zone
|
||||||
|
* tile. Note: the input tile MUST be a full-size res zone,
|
||||||
|
* it cannot be an empty zone.
|
||||||
|
* @return int multiple of 8 between 16 and 40.
|
||||||
|
*/
|
||||||
|
public static int residentialZonePop(int tile)
|
||||||
|
{
|
||||||
|
tile &= LOMASK;
|
||||||
|
int czDen = ((tile - RZB) / 9) % 4;
|
||||||
|
return czDen * 8 + 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the population level of a Commercial zone
|
||||||
|
* tile.
|
||||||
|
* The input tile MAY be an empty zone.
|
||||||
|
* @return int between 0 and 5.
|
||||||
|
*/
|
||||||
|
public static int commercialZonePop(int tile)
|
||||||
|
{
|
||||||
|
tile &= LOMASK;
|
||||||
|
if (tile == COMCLR)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int czDen = ((tile - CZB) / 9) % 5 + 1;
|
||||||
|
return czDen;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the population level of an Industrial zone tile.
|
||||||
|
* The input tile MAY be an empty zone.
|
||||||
|
* @return int between 0 and 4.
|
||||||
|
*/
|
||||||
|
public static int industrialZonePop(int tile)
|
||||||
|
{
|
||||||
|
tile &= LOMASK;
|
||||||
|
if (tile == INDCLR)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int czDen = ((tile - IZB) / 9) % 4 + 1;
|
||||||
|
return czDen;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue