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

Function maybeExplore

plugins/digFlood.cpp:98–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98void maybeExplore(color_ostream& out, MapExtras::MapCache& cache, df::coord pt, set<df::coord>& jobLocations) {
99 if ( !Maps::isValidTilePos(pt) ) {
100 return;
101 }
102
103 df::map_block* block = Maps::getTileBlock(pt);
104 if (!block)
105 return;
106
107 if ( block->designation[pt.x&0xF][pt.y&0xF].bits.hidden )
108 return;
109
110 df::tiletype type = block->tiletype[pt.x&0xF][pt.y&0xF];
111 if ( ENUM_ATTR(tiletype, material, type) != df::enums::tiletype_material::MINERAL )
112 return;
113 if ( ENUM_ATTR(tiletype, shape, type) != df::enums::tiletype_shape::WALL )
114 return;
115
116 if ( block->designation[pt.x&0xF][pt.y&0xF].bits.dig != df::enums::tile_dig_designation::No )
117 return;
118
119 uint32_t xMax,yMax,zMax;
120 Maps::getSize(xMax,yMax,zMax);
121 if ( pt.x == 0 || pt.y == 0 || pt.x+1 == int32_t(xMax)*16 || pt.y+1 == int32_t(yMax)*16 )
122 return;
123 if ( jobLocations.find(pt) != jobLocations.end() ) {
124 return;
125 }
126
127 int16_t mat = cache.veinMaterialAt(pt);
128 if ( mat == -1 )
129 return;
130 if ( !digAll ) {
131 df::inorganic_raw* inorganic = world->raws.inorganics[mat];
132 if ( autodigMaterials.find(inorganic->id) == autodigMaterials.end() ) {
133 return;
134 }
135 }
136
137 block->designation[pt.x&0xF][pt.y&0xF].bits.dig = df::enums::tile_dig_designation::Default;
138 block->flags.bits.designated = true;
139// *process_dig = true;
140// *process_jobs = true;
141}
142
143command_result digFlood (color_ostream &out, std::vector <std::string> & parameters)
144{

Callers 1

onDigFunction · 0.85

Calls 4

isValidTilePosFunction · 0.85
getTileBlockFunction · 0.85
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected