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

Method initMapArrays

MicropolisCore/src/MicropolisEngine/src/allocate.cpp:75–96  ·  view source on GitHub ↗

Allocate and initialize arrays for the maps */

Source from the content-addressed store, hash-verified

73
74/** Allocate and initialize arrays for the maps */
75void Micropolis::initMapArrays()
76{
77 short i;
78
79 if (!mapBase) {
80 mapBase = (unsigned short *)newPtr(
81 sizeof(unsigned short) *
82 WORLD_W * WORLD_H);
83 }
84
85 for (i = 0; i < WORLD_W; i++) {
86 map[i] = (unsigned short *)(mapBase + (i * WORLD_H));
87 }
88
89 resHist = (short *)newPtr(HISTORY_LENGTH);
90 comHist = (short *)newPtr(HISTORY_LENGTH);
91 indHist = (short *)newPtr(HISTORY_LENGTH);
92 moneyHist = (short *)newPtr(HISTORY_LENGTH);
93 pollutionHist = (short *)newPtr(HISTORY_LENGTH);
94 crimeHist = (short *)newPtr(HISTORY_LENGTH);
95 miscHist = (short *)newPtr(MISC_HISTORY_LENGTH);
96}
97
98
99/** Free all map arrays */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected