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

Method doZone

MicropolisCore/src/MicropolisEngine/src/zone.cpp:79–127  ·  view source on GitHub ↗

* Handle zone. * @param pos Position of the zone. */

Source from the content-addressed store, hash-verified

77 * @param pos Position of the zone.
78 */
79void Micropolis::doZone(const Position &pos)
80{
81 // Set Power Bit in Map from powerGridMap
82 bool zonePowerFlag = setZonePower(pos);
83
84
85 if (zonePowerFlag) {
86 poweredZoneCount++;
87 } else {
88 unpoweredZoneCount++;
89 }
90
91 MapTile tile = map[pos.posX][pos.posY] & LOMASK;
92
93 // Do special zones.
94 if ((tile > PORTBASE) &&
95 (tile < CHURCH1BASE)) {
96 doSpecialZone(pos, zonePowerFlag);
97 return;
98 }
99
100 // Do residential zones.
101 if (tile < HOSPITAL) {
102 doResidential(pos, zonePowerFlag);
103 return;
104 }
105
106 // Do hospitals and churches.
107 if ((tile < COMBASE) ||
108 ((tile >= CHURCH1BASE) &&
109 (tile <= CHURCH7LAST))) {
110 doHospitalChurch(pos);
111 return;
112 }
113
114 // Do commercial zones.
115 if (tile < INDBASE) {
116 doCommercial(pos, zonePowerFlag);
117 return;
118 }
119
120 // Do industrial zones.
121 if (tile < CHURCH1BASE) {
122 doIndustrial(pos, zonePowerFlag);
123 return;
124 }
125
126 printf("UNEXPOECTED ZONE: %d !!!\n", tile);
127}
128
129/**
130 * Handle repairing or removing of hospitals and churches.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected