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

Method doSpecialZone

MicropolisCore/src/MicropolisEngine/src/simulate.cpp:1431–1600  ·  view source on GitHub ↗

* Update special zones. * @param pos Position of the zone. * @param powerOn Zone is powered. */

Source from the content-addressed store, hash-verified

1429 * @param powerOn Zone is powered.
1430 */
1431void Micropolis::doSpecialZone(const Position &pos, bool powerOn)
1432{
1433 // Bigger numbers reduce chance of nuclear melt down
1434 static const short meltdownTable[3] = { 30000, 20000, 10000 };
1435
1436 MapTile tile = map[pos.posX][pos.posY] & LOMASK;
1437
1438 switch (tile) {
1439
1440 case POWERPLANT:
1441
1442 coalPowerPop++;
1443
1444 if ((cityTime & 7) == 0) {
1445 repairZone(pos, POWERPLANT, 4); /* post */
1446 }
1447
1448 pushPowerStack(pos);
1449 coalSmoke(pos);
1450
1451 return;
1452
1453 case NUCLEAR:
1454
1455 assert(LEVEL_COUNT == LENGTH_OF(meltdownTable));
1456
1457 if (enableDisasters && !getRandom(meltdownTable[gameLevel])) {
1458 doMeltdown(pos);
1459 return;
1460 }
1461
1462 nuclearPowerPop++;
1463
1464 if ((cityTime & 7) == 0) {
1465 repairZone(pos, NUCLEAR, 4); /* post */
1466 }
1467
1468 pushPowerStack(pos);
1469
1470 return;
1471
1472 case FIRESTATION: {
1473
1474 int z;
1475
1476 fireStationPop++;
1477
1478 if (!(cityTime & 7)) {
1479 repairZone(pos, FIRESTATION, 3); /* post */
1480 }
1481
1482 if (powerOn) {
1483 z = fireEffect; /* if powered get effect */
1484 } else {
1485 z = fireEffect / 2; /* from the funding ratio */
1486 }
1487
1488 Position pos2(pos);

Callers

nothing calls this directly

Calls 2

worldGetMethod · 0.80
worldSetMethod · 0.80

Tested by

no test coverage detected