MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / Map_AddSpiceOnTile

Function Map_AddSpiceOnTile

src/map.c:1375–1415  ·  view source on GitHub ↗

* Add spice on the given tile. * @param packed The tile. */

Source from the content-addressed store, hash-verified

1373 * @param packed The tile.
1374 */
1375static void Map_AddSpiceOnTile(uint16 packed)
1376{
1377 Tile *t;
1378
1379 t = &g_map[packed];
1380
1381 switch (t->groundTileID) {
1382 case LST_SPICE:
1383 t->groundTileID = LST_THICK_SPICE;
1384 Map_AddSpiceOnTile(packed);
1385 return;
1386
1387 case LST_THICK_SPICE: {
1388 int8 i;
1389 int8 j;
1390
1391 for (j = -1; j <= 1; j++) {
1392 for (i = -1; i <= 1; i++) {
1393 Tile *t2;
1394 uint16 packed2 = Tile_PackXY(Tile_GetPackedX(packed) + i, Tile_GetPackedY(packed) + j);
1395
1396 if (Tile_IsOutOfMap(packed2)) continue;
1397
1398 t2 = &g_map[packed2];
1399
1400 if (!g_table_landscapeInfo[t2->groundTileID].canBecomeSpice) {
1401 t->groundTileID = LST_SPICE;
1402 continue;
1403 }
1404
1405 if (t2->groundTileID != LST_THICK_SPICE) t2->groundTileID = LST_SPICE;
1406 }
1407 }
1408 return;
1409 }
1410
1411 default:
1412 if (g_table_landscapeInfo[t->groundTileID].canBecomeSpice) t->groundTileID = LST_SPICE;
1413 return;
1414 }
1415}
1416
1417static const uint16 _offsetTable[2][21][4] = {
1418 {

Callers 1

Map_CreateLandscapeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected