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

Function embark_prospector

plugins/prospector.cpp:569–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

567}
568
569static command_result embark_prospector(color_ostream &out,
570 df::viewscreen_choose_start_sitest *screen,
571 const prospect_options &options)
572{
573 if (!world->world_data) {
574 out.printerr("World data is not available.\n");
575 return CR_FAILURE;
576 }
577
578 // Compute material maps
579 MatMap layerMats;
580 MatMap veinMats;
581 matdata world_bottom;
582
583 // Compute biomes
584 std::map<coord2d, int> biomes;
585
586 int32_t max_x = (world->worldgen.worldgen_parms.dim_x * 16) - 1;
587 int32_t max_y = (world->worldgen.worldgen_parms.dim_y * 16) - 1;
588
589 for (int x = screen->location.embark_pos_min.x; x <= max_x && x <= screen->location.embark_pos_max.x; ++x) {
590 for (int y = screen->location.embark_pos_min.y; y <= max_y && y <= screen->location.embark_pos_max.y; ++y) {
591 auto cur_details = get_details(world->world_data, coord2d(x / 16, y / 16));
592
593 if (!cur_details)
594 continue;
595
596 EmbarkTileLayout tile;
597 if (!estimate_underground(out, tile, cur_details, x % 16, y % 16) ||
598 !estimate_materials(out, tile, layerMats, veinMats))
599 return CR_FAILURE;
600
601 world_bottom.add(tile.base_z, 0);
602 world_bottom.add(tile.elevation-1, 0);
603 }
604 }
605
606 // Print the report
607 if (options.layers) {
608 out << "Layer materials:" << std::endl;
609 printMats<df::inorganic_raw, shallower>(out, layerMats, world->raws.inorganics.all, options);
610 }
611
612 if (options.hidden) {
613 printVeins(out, veinMats, options);
614 }
615
616 out << "Embark depth: " << (world_bottom.upper_z-world_bottom.lower_z+1) << " ";
617 printMatdata(out, world_bottom, true);
618
619 out << std::endl << "Warning: the above data is only a very rough estimate." << std::endl;
620
621 return CR_OK;
622}
623
624static command_result map_prospector(color_ostream &con,
625 const prospect_options &options) {

Callers 1

prospectorFunction · 0.85

Calls 6

get_detailsFunction · 0.85
estimate_undergroundFunction · 0.85
estimate_materialsFunction · 0.85
printVeinsFunction · 0.85
printMatdataFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected