* Evaluate suitability of the position for placing a new house. * @return Suitability. */
| 498 | * @return Suitability. |
| 499 | */ |
| 500 | short 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. |
nothing calls this directly
no test coverage detected