MCPcopy Create free account
hub / github.com/SimHacker/micropolis / repairZone

Method repairZone

MicropolisCore/src/MicropolisEngine/src/simulate.cpp:1390–1423  ·  view source on GitHub ↗

* Repair a zone at \a pos. * @param pos Center-tile position of the zone. * @param zCent Value of the center tile. * @param zSize Size of the zone (in both directions). */

Source from the content-addressed store, hash-verified

1388 * @param zSize Size of the zone (in both directions).
1389 */
1390void Micropolis::repairZone(const Position &pos, MapTile zCent, short zSize)
1391{
1392 MapTile tile = zCent - 2 - zSize;
1393
1394 // y and x loops one position shifted to compensate for the center-tile position.
1395 for (short y = -1; y < zSize - 1; y++) {
1396 for (short x = -1; x < zSize - 1; x++) {
1397
1398 int xx = pos.posX + x;
1399 int yy = pos.posY + y;
1400
1401 tile++;
1402
1403 if (testBounds(xx, yy)) {
1404
1405 MapValue mapValue = map[xx][yy];
1406
1407 if (mapValue & ZONEBIT) {
1408 continue;
1409 }
1410
1411 if (mapValue & ANIMBIT) {
1412 continue;
1413 }
1414
1415 MapTile mapTile = mapValue & LOMASK;
1416
1417 if (mapTile < RUBBLE || mapTile >= ROADBASE) {
1418 map[xx][yy] = tile | CONDBIT | BURNBIT;
1419 }
1420 }
1421 }
1422 }
1423}
1424
1425
1426/**

Callers

nothing calls this directly

Calls 1

testBoundsFunction · 0.85

Tested by

no test coverage detected