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

Method doFreePop

MicropolisCore/src/MicropolisEngine/src/zone.cpp:395–411  ·  view source on GitHub ↗

* Count the number of single tile houses in a residential zone. * @param pos Position of the residential zone. * @return Number of single tile houses. */

Source from the content-addressed store, hash-verified

393 * @return Number of single tile houses.
394 */
395short Micropolis::doFreePop(const Position &pos)
396{
397 short count = 0;
398
399 for (short x = pos.posX - 1; x <= pos.posX + 1; x++) {
400 for (short y = pos.posY - 1; y <= pos.posY + 1; y++) {
401 if (x >= 0 && x < WORLD_W && y >= 0 && y < WORLD_H) {
402 MapTile tile = map[x][y] & LOMASK;
403 if (tile >= LHTHR && tile <= HHTHR) {
404 count++;
405 }
406 }
407 }
408 }
409
410 return count;
411}
412
413
414/**

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected