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

Function map_prospector

plugins/prospector.cpp:624–894  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

622}
623
624static command_result map_prospector(color_ostream &con,
625 const prospect_options &options) {
626 if (!Maps::IsValid())
627 {
628 con.printerr("Map is not available!\n");
629 return CR_FAILURE;
630 }
631
632 uint32_t x_max = 0, y_max = 0, z_max = 0;
633 Maps::getSize(x_max, y_max, z_max);
634 MapExtras::MapCache map;
635
636 DFHack::t_feature blockFeatureGlobal;
637 DFHack::t_feature blockFeatureLocal;
638
639 bool hasDemonTemple = false;
640 bool hasLair = false;
641 MatMap baseMats;
642 MatMap layerMats;
643 MatMap veinMats;
644 MatMap plantMats;
645 MatMap treeMats;
646
647 matdata liquidWater;
648 matdata liquidMagma;
649 matdata aquiferTiles;
650 matdata tubeTiles;
651
652 for(uint32_t z = 0; z < z_max; z++)
653 {
654 // the '- 100' is because DF v50 and later have a 100 offset in reported elevation
655 int global_z = world->map.region_z + z - 100;
656
657 for(uint32_t b_y = 0; b_y < y_max; b_y++)
658 {
659 for(uint32_t b_x = 0; b_x < x_max; b_x++)
660 {
661 // Get the map block
662 df::coord2d blockCoord(b_x, b_y);
663 MapExtras::Block *b = map.BlockAt(DFHack::DFCoord(b_x, b_y, z));
664 if (!b || !b->is_valid())
665 {
666 continue;
667 }
668
669 // Find features
670 b->GetGlobalFeature(&blockFeatureGlobal);
671 b->GetLocalFeature(&blockFeatureLocal);
672
673 // Iterate over all the tiles in the block
674 for(uint32_t y = 0; y < 16; y++)
675 {
676 for(uint32_t x = 0; x < 16; x++)
677 {
678 df::coord2d coord(x, y);
679 df::tile_designation des = b->DesignationAt(coord);
680 df::tile_occupancy occ = b->OccupancyAt(coord);
681

Callers 1

prospectorFunction · 0.85

Calls 11

tileShapeFunction · 0.85
tileMaterialFunction · 0.85
printMatdataFunction · 0.85
printVeinsFunction · 0.85
BlockAtMethod · 0.80
GetLocalFeatureMethod · 0.80
tiletypeAtMethod · 0.80
GetGlobalFeatureMethod · 0.45
addMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected