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

Method BlockAt

library/modules/MapCache.cpp:1336–1357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1334}
1335
1336MapExtras::Block *MapExtras::MapCache::BlockAt(DFCoord blockcoord)
1337{
1338 if(!valid)
1339 return 0;
1340 std::map <DFCoord, Block*>::iterator iter = blocks.find(blockcoord);
1341 if(iter != blocks.end())
1342 {
1343 return (*iter).second;
1344 }
1345 else
1346 {
1347 if(unsigned(blockcoord.x) < x_bmax &&
1348 unsigned(blockcoord.y) < y_bmax &&
1349 unsigned(blockcoord.z) < z_max)
1350 {
1351 Block * nblo = new Block(this, blockcoord);
1352 blocks[blockcoord] = nblo;
1353 return nblo;
1354 }
1355 return 0;
1356 }
1357}
1358
1359void MapExtras::MapCache::discardBlock(Block *block)
1360{

Callers 12

df_liquids_executeFunction · 0.80
df_changeitemFunction · 0.80
findTopBlockFunction · 0.80
scan_tilesMethod · 0.80
write_tilesMethod · 0.80
map_prospectorFunction · 0.80
digFunction · 0.80
df_probeFunction · 0.80
doSunMethod · 0.80
doOcupancyAndLightsMethod · 0.80
df_tilesFunction · 0.80
StockpileInfoMethod · 0.80

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by 1

map_prospectorFunction · 0.64