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

Method mapScan

MicropolisCore/src/MicropolisEngine/src/simulate.cpp:929–997  ·  view source on GitHub ↗

comefrom: simulate doSimInit */

Source from the content-addressed store, hash-verified

927
928/* comefrom: simulate doSimInit */
929void Micropolis::mapScan(int x1, int x2)
930{
931 short x, y;
932
933 for (x = x1; x < x2; x++) {
934 for (y = 0; y < WORLD_H; y++) {
935
936 MapValue mapVal = map[x][y];
937 if (mapVal == DIRT) {
938 continue;
939 }
940
941 MapTile tile = mapVal & LOMASK; /* Mask off status bits */
942
943 if (tile < FLOOD) {
944 continue;
945 }
946
947 // tile >= FLOOD
948
949 Position pos(x, y);
950
951
952 if (tile < ROADBASE) {
953
954 if (tile >= FIREBASE) {
955 firePop++;
956 if (!(getRandom16() & 3)) {
957 doFire(pos); /* 1 in 4 times */
958 }
959 continue;
960 }
961
962 if (tile < RADTILE) {
963 doFlood(pos);
964 } else {
965 doRadTile(pos);
966 }
967
968 continue;
969 }
970
971 if (newPower && (mapVal & CONDBIT)) {
972 // Copy PWRBIT from powerGridMap
973 setZonePower(pos);
974 }
975
976 if (tile >= ROADBASE && tile < POWERBASE) {
977 doRoad(pos);
978 continue;
979 }
980
981 if (mapVal & ZONEBIT) { /* process Zones */
982 doZone(pos);
983 continue;
984 }
985
986 if (tile >= RAILBASE && tile < RESBASE) {

Callers

nothing calls this directly

Calls 1

randomRubbleFunction · 0.85

Tested by

no test coverage detected