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

Method doResOut

MicropolisCore/src/MicropolisEngine/src/zone.cpp:641–686  ·  view source on GitHub ↗

* Perform residential emigration from the current residential tile. * @param pos Position of the tile. * @param pop Population ? * @param value Land value corrected for pollution. */

Source from the content-addressed store, hash-verified

639 * @param value Land value corrected for pollution.
640 */
641void Micropolis::doResOut(const Position &pos, int pop, int value)
642{
643 static short Brdr[9] = {0,3,6,1,4,7,2,5,8};
644 short x, y, loc, z;
645
646 if (!pop) {
647 return;
648 }
649
650 if (pop > 16) {
651 resPlop(pos, (pop - 24) / 8, value);
652 incRateOfGrowth(pos, -8);
653 return;
654 }
655
656 if (pop == 16) {
657 incRateOfGrowth(pos, -8);
658 map[pos.posX][pos.posY] = (FREEZ | BLBNCNBIT | ZONEBIT);
659 for (x = pos.posX - 1; x <= pos.posX + 1; x++) {
660 for (y = pos.posY - 1; y <= pos.posY + 1; y++) {
661 if (testBounds(x, y)) {
662 if ((map[x][y] & LOMASK) != FREEZ) {
663 map[x][y] = LHTHR + value + getRandom(2) + BLBNCNBIT;
664 }
665 }
666 }
667 }
668 }
669
670 if (pop < 16) {
671 incRateOfGrowth(pos, -1);
672 z = 0;
673 for (x = pos.posX - 1; x <= pos.posX + 1; x++) {
674 for (y = pos.posY - 1; y <= pos.posY + 1; y++) {
675 if (testBounds(x, y)) {
676 loc = map[x][y] & LOMASK;
677 if ((loc >= LHTHR) && (loc <= HHTHR)) {
678 map[x][y] = Brdr[z] + BLBNCNBIT + FREEZ - 4;
679 return;
680 }
681 }
682 z++;
683 }
684 }
685 }
686}
687
688
689/**

Callers

nothing calls this directly

Calls 1

testBoundsFunction · 0.85

Tested by

no test coverage detected