MCPcopy Create free account
hub / github.com/DFHack/dfhack / doDeramp

Function doDeramp

plugins/deramp.cpp:24–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22REQUIRE_GLOBAL(world);
23
24static void doDeramp(df::map_block* block, df::map_block* above, int x, int y, df::tiletype oldT)
25{
26 // Current tile is a ramp.
27 // Set current tile, as accurately as can be expected
28 df::tiletype newT = findSimilarTileType(oldT, tiletype_shape::FLOOR);
29
30 // If no change, skip it (couldn't find a good tile type)
31 if (oldT == newT)
32 return;
33 // Set new tile type, clear designation
34 block->tiletype[x][y] = newT;
35 block->designation[x][y].bits.dig = tile_dig_designation::No;
36
37 // Check the tile above this one, in case a downward slope needs to be removed.
38 if ((above) && (tileShape(above->tiletype[x][y]) == tiletype_shape::RAMP_TOP))
39 above->tiletype[x][y] = tiletype::OpenSpace; // open space
40}
41
42command_result df_deramp (color_ostream &out, vector <string> & parameters)
43{

Callers 1

df_derampFunction · 0.85

Calls 2

findSimilarTileTypeFunction · 0.85
tileShapeFunction · 0.85

Tested by

no test coverage detected