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

Method evalLot

MicropolisCore/src/MicropolisEngine/src/zone.cpp:500–527  ·  view source on GitHub ↗

* Evaluate suitability of the position for placing a new house. * @return Suitability. */

Source from the content-addressed store, hash-verified

498 * @return Suitability.
499 */
500short Micropolis::evalLot(int x, int y)
501{
502 short z, score;
503 static short DX[4] = { 0, 1, 0,-1};
504 static short DY[4] = {-1, 0, 1, 0};
505
506 /* test for clear lot */
507 z = map[x][y] & LOMASK;
508
509 if (z && (z < RESBASE || z > RESBASE + 8)) {
510 return -1;
511 }
512
513 score = 1;
514
515 for (z = 0; z < 4; z++) {
516 int xx = x + DX[z];
517 int yy = y + DY[z];
518
519 if (testBounds(xx, yy) &&
520 map[xx][yy] != DIRT && (map[xx][yy] & LOMASK) <= LASTROAD) {
521 score++; /* look for road */
522 }
523
524 }
525
526 return score;
527}
528
529/**
530 * Handle residential zone.

Callers

nothing calls this directly

Calls 1

testBoundsFunction · 0.85

Tested by

no test coverage detected