cleanup: repairZone: use zoneBase variable to place tiles
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@550 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
de8b27d10a
commit
deb9738b6f
1 changed files with 8 additions and 6 deletions
|
@ -715,23 +715,25 @@ class MapScanner
|
||||||
/**
|
/**
|
||||||
* Regenerate the tiles that make up the zone, repairing from
|
* Regenerate the tiles that make up the zone, repairing from
|
||||||
* fire, etc.
|
* fire, etc.
|
||||||
* Only tiles that aren't rubble will be regenerated.
|
* Only tiles that are not rubble, radioactive, flooded, or
|
||||||
|
* on fire will be regenerated.
|
||||||
* @param zoneCenter the tile value for the "center" tile of the zone
|
* @param zoneCenter the tile value for the "center" tile of the zone
|
||||||
* @param zoneSize integer (3-6) indicating the width/height of
|
* @param zoneSize integer (3-6) indicating the width/height of
|
||||||
* the zone.
|
* the zone.
|
||||||
*/
|
*/
|
||||||
void repairZone(char zoneCenter, int zoneSize)
|
void repairZone(char zoneCenter, int zoneSize)
|
||||||
{
|
{
|
||||||
int cnt=0;
|
// from the given center tile, figure out what the
|
||||||
|
// northwest tile should be
|
||||||
|
int zoneBase = zoneCenter - 1 - zoneSize;
|
||||||
|
|
||||||
for (int y = 0; y < zoneSize; y++)
|
for (int y = 0; y < zoneSize; y++)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < zoneSize; x++)
|
for (int x = 0; x < zoneSize; x++, zoneBase++)
|
||||||
{
|
{
|
||||||
int xx = xpos - 1 + x;
|
int xx = xpos - 1 + x;
|
||||||
int yy = ypos - 1 + y;
|
int yy = ypos - 1 + y;
|
||||||
|
|
||||||
cnt++;
|
|
||||||
|
|
||||||
if (city.testBounds(xx, yy))
|
if (city.testBounds(xx, yy))
|
||||||
{
|
{
|
||||||
int thCh = city.map[yy][xx];
|
int thCh = city.map[yy][xx];
|
||||||
|
@ -746,7 +748,7 @@ class MapScanner
|
||||||
{ //not rubble, radiactive, on fire or flooded
|
{ //not rubble, radiactive, on fire or flooded
|
||||||
|
|
||||||
city.setTile(xx,yy,(char)
|
city.setTile(xx,yy,(char)
|
||||||
(zoneCenter-2-zoneSize+cnt+CONDBIT+BURNBIT)
|
(zoneBase+CONDBIT+BURNBIT)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue