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

Method setSmoke

MicropolisCore/src/MicropolisEngine/src/zone.cpp:223–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221#define REGBIT (CONDBIT | BURNBIT)
222
223void Micropolis::setSmoke(const Position &pos, bool zonePower)
224{
225 static bool aniThis[8] = { true, false, true, true, false, false, true, true };
226 static short dx1[8] = { -1, 0, 1, 0, 0, 0, 0, 1 };
227 static short dy1[8] = { -1, 0, -1, -1, 0, 0, -1, -1 };
228 static short aniTabA[8] = { 0, 0, 32, 40, 0, 0, 48, 56 };
229 static short aniTabB[8] = { 0, 0, 36, 44, 0, 0, 52, 60 };
230 static short aniTabC[8] = { IND1, 0, IND2, IND4, 0, 0, IND6, IND8 };
231 static short aniTabD[8] = { IND1, 0, IND3, IND5, 0, 0, IND7, IND9 };
232
233 MapTile tile = map[pos.posX][pos.posY] & LOMASK;
234
235 if (tile < IZB) {
236 return;
237 }
238
239 int z = (tile - IZB) >>3; /// @todo Why div 8? Industry is 9 tiles long!!
240 z = z & 7;
241
242 if (aniThis[z]) {
243 int xx = pos.posX + dx1[z];
244 int yy = pos.posY + dy1[z];
245
246 if (testBounds(xx, yy)) {
247
248 if (zonePower) {
249
250 /// @todo Why do we assign the same map position twice?
251 /// @todo Add #SMOKEBASE into aniTabA and aniTabB tables?
252 if ((map[xx][yy] & LOMASK) == aniTabC[z]) {
253 map[xx][yy] = ASCBIT | (SMOKEBASE + aniTabA[z]);
254 map[xx][yy] = ASCBIT | (SMOKEBASE + aniTabB[z]);
255 }
256
257 } else {
258
259 /// @todo Why do we assign the same map position twice?
260 if ((map[xx][yy] & LOMASK) > aniTabC[z]) {
261 map[xx][yy] = REGBIT | aniTabC[z];
262 map[xx][yy] = REGBIT | aniTabD[z];
263 }
264
265 }
266
267 }
268
269 }
270
271}
272
273
274/**

Callers

nothing calls this directly

Calls 1

testBoundsFunction · 0.85

Tested by

no test coverage detected