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

Method setZonePower

MicropolisCore/src/MicropolisEngine/src/zone.cpp:419–436  ·  view source on GitHub ↗

* Copy the value of #powerGridMap at position \a pos to the map. * @param pos Position to copy. * @return Does the tile have power? */

Source from the content-addressed store, hash-verified

417 * @return Does the tile have power?
418 */
419bool Micropolis::setZonePower(const Position &pos)
420{
421 MapValue mapValue = map[pos.posX][pos.posY];
422 MapTile tile = mapValue & LOMASK;
423
424 if (tile == NUCLEAR || tile == POWERPLANT) {
425 map[pos.posX][pos.posY] = mapValue | PWRBIT;
426 return true;
427 }
428
429 if (powerGridMap.worldGet(pos.posX, pos.posY)) {
430 map[pos.posX][pos.posY] = mapValue | PWRBIT;
431 return true;
432 } else {
433 map[pos.posX][pos.posY] = mapValue & (~PWRBIT);
434 return false;
435 }
436}
437
438
439/**

Callers

nothing calls this directly

Calls 1

worldGetMethod · 0.80

Tested by

no test coverage detected