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

Method hasSupport

library/modules/Buildings.cpp:887–909  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

885}
886
887bool Buildings::hasSupport(df::coord pos, df::coord2d size)
888{
889 for (int dx = -1; dx <= size.x; dx++)
890 {
891 for (int dy = -1; dy <= size.y; dy++)
892 {
893 // skip corners
894 if ((dx < 0 || dx == size.x) && (dy < 0 || dy == size.y))
895 continue;
896
897 df::coord tile = pos + df::coord(dx,dy,0);
898 df::map_block *block = Maps::getTileBlock(tile);
899 if (!block)
900 continue;
901
902 df::coord2d btile = df::coord2d(tile) & 15;
903 if (!isOpenTerrain(block->tiletype[btile.x][btile.y]))
904 return true;
905 }
906 }
907
908 return false;
909}
910
911static int computeMaterialAmount(df::building *bld)
912{

Callers

nothing calls this directly

Calls 2

getTileBlockFunction · 0.85
isOpenTerrainFunction · 0.85

Tested by

no test coverage detected