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

Method testForConductive

MicropolisCore/src/MicropolisEngine/src/power.cpp:94–107  ·  view source on GitHub ↗

* Check at position \a pos for a power-less conducting tile in the * direction \a testDir. * @param pos Position to start from. * @param testDir Direction to investigate. * @return Unpowered tile has been found in the indicated direction. * @todo Re-use something like Micropolis::getFromMap(), and fold this function * into its caller. */

Source from the content-addressed store, hash-verified

92 * into its caller.
93 */
94bool Micropolis::testForConductive(const Position& pos, Direction2 testDir)
95{
96 Position movedPos(pos);
97
98 if (movedPos.move(testDir)) {
99 if ((map[movedPos.posX][movedPos.posY] & CONDBIT) == CONDBIT) {
100 if (!powerGridMap.worldGet(movedPos.posX, movedPos.posY)) {
101 return true;
102 }
103 }
104 }
105
106 return false;
107}
108
109
110/**

Callers

nothing calls this directly

Calls 2

worldGetMethod · 0.80
moveMethod · 0.45

Tested by

no test coverage detected