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

Method getPopulationDensity

MicropolisCore/src/MicropolisEngine/src/scan.cpp:188–213  ·  view source on GitHub ↗

* Get population of a zone. * @param pos Position of the zone to count. * @param tile Tile of the zone. * @return Population of the zone. */

Source from the content-addressed store, hash-verified

186 * @return Population of the zone.
187 */
188int Micropolis::getPopulationDensity(const Position &pos, MapTile tile)
189{
190 int pop;
191
192 if (tile == FREEZ) {
193 pop = doFreePop(pos);
194 return pop;
195 }
196
197 if (tile < COMBASE) {
198 pop = getResZonePop(tile);
199 return pop;
200 }
201
202 if (tile < INDBASE) {
203 pop = getComZonePop(tile) * 8;
204 return pop;
205 }
206
207 if (tile < PORTBASE) {
208 pop = getIndZonePop(tile) * 8;
209 return pop;
210 }
211
212 return 0;
213}
214
215
216/* comefrom: simulate SpecialInit */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected