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

Method getPollutionValue

MicropolisCore/src/MicropolisEngine/src/scan.cpp:331–371  ·  view source on GitHub ↗

* Return pollution of a tile value * @param loc Tile character * @return Value of the pollution (0..255, bigger is worse) */

Source from the content-addressed store, hash-verified

329 * @return Value of the pollution (0..255, bigger is worse)
330 */
331int Micropolis::getPollutionValue(int loc)
332{
333 if (loc < POWERBASE) {
334
335 if (loc >= HTRFBASE) {
336 return /* 25 */ 75; /* heavy traf */
337 }
338
339 if (loc >= LTRFBASE) {
340 return /* 10 */ 50; /* light traf */
341 }
342
343 if (loc < ROADBASE) {
344
345 if (loc > FIREBASE) {
346 return /* 60 */ 90;
347 }
348
349 /* XXX: Why negative pollution from radiation? */
350 if (loc >= RADTILE) {
351 return /* -40 */ 255; /* radioactivity */
352 }
353
354 }
355 return 0;
356 }
357
358 if (loc <= LASTIND) {
359 return 0;
360 }
361
362 if (loc < PORTBASE) {
363 return 50; /* Ind */
364 }
365
366 if (loc <= LASTPOWERPLANT) {
367 return /* 60 */ 100; /* prt, aprt, cpp */
368 }
369
370 return 0;
371}
372
373
374/**

Callers 1

ptlScanMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected