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

Function likely

plugins/channel-safely/channel-groups.cpp:24–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23bool ChannelJobs::has_cavein_conditions(const df::coord &map_pos) {
24 if likely(Maps::isValidTilePos(map_pos)) {
25 auto p = map_pos;
26 auto ttype = *Maps::getTileType(p);
27 if (!DFHack::isOpenTerrain(ttype)) {
28 // check shared neighbour for cave-in conditions
29 df::coord neighbours[4];
30 get_connected_neighbours(map_pos, neighbours);
31 int connectedness = 4;
32 for (auto n: neighbours) {
33 if (!Maps::isValidTilePos(n) || active.count(n) || DFHack::isOpenTerrain(*Maps::getTileType(n))) {
34 connectedness--;
35 }
36 }
37 if (!connectedness) {
38 // do what?
39 p.z--;
40 if (!Maps::isValidTilePos(p)) return false;
41 ttype = *Maps::getTileType(p);
42 if (DFHack::isOpenTerrain(ttype) || DFHack::isFloorTerrain(ttype)) {
43 return true;
44 }
45 }
46 }
47 }
48 return false;
49}
50

Callers

nothing calls this directly

Calls 6

getTileTypeFunction · 0.85
isOpenTerrainFunction · 0.85
get_connected_neighboursFunction · 0.85
isValidTilePosFunction · 0.85
isFloorTerrainFunction · 0.85
countMethod · 0.45

Tested by

no test coverage detected