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:
jason@long.name 2013-02-18 01:57:27 +00:00
parent de8b27d10a
commit deb9738b6f

View file

@ -715,23 +715,25 @@ class MapScanner
/**
* Regenerate the tiles that make up the zone, repairing from
* 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 zoneSize integer (3-6) indicating the width/height of
* the zone.
*/
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 x = 0; x < zoneSize; x++)
for (int x = 0; x < zoneSize; x++, zoneBase++)
{
int xx = xpos - 1 + x;
int yy = ypos - 1 + y;
cnt++;
if (city.testBounds(xx, yy))
{
int thCh = city.map[yy][xx];
@ -746,7 +748,7 @@ class MapScanner
{ //not rubble, radiactive, on fire or flooded
city.setTile(xx,yy,(char)
(zoneCenter-2-zoneSize+cnt+CONDBIT+BURNBIT)
(zoneBase+CONDBIT+BURNBIT)
);
}
}