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

Method decTrafficMap

MicropolisCore/src/MicropolisEngine/src/simulate.cpp:327–351  ·  view source on GitHub ↗

Decrease traffic memory */

Source from the content-addressed store, hash-verified

325
326/** Decrease traffic memory */
327void Micropolis::decTrafficMap()
328{
329 /* tends to empty trafficDensityMap */
330 short x, y, z;
331
332 for (x = 0; x < WORLD_W; x += trafficDensityMap.MAP_BLOCKSIZE) {
333 for (y = 0; y < WORLD_H; y += trafficDensityMap.MAP_BLOCKSIZE) {
334 z = trafficDensityMap.worldGet(x, y);
335 if (z == 0) {
336 continue;
337 }
338
339 if (z <= 24) {
340 trafficDensityMap.worldSet(x, y, 0);
341 continue;
342 }
343
344 if (z > 200) {
345 trafficDensityMap.worldSet(x, y, z - 34);
346 } else {
347 trafficDensityMap.worldSet(x, y, z - 24);
348 }
349 }
350 }
351}
352
353
354/**

Callers

nothing calls this directly

Calls 2

worldGetMethod · 0.80
worldSetMethod · 0.80

Tested by

no test coverage detected