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

Function stamp_pattern

plugins/dig.cpp:1188–1239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1186};
1187
1188bool stamp_pattern (uint32_t bx, uint32_t by, int z_level,
1189 digmask & dm, explo_how how, explo_what what,
1190 int x_max, int y_max
1191 )
1192{
1193 df::map_block * bl = Maps::getBlock(bx,by,z_level);
1194 if(!bl)
1195 return false;
1196 int x = 0,mx = 16;
1197 if(bx == 0)
1198 x = 1;
1199 if(int(bx) == x_max - 1)
1200 mx = 15;
1201 for(; x < mx; x++)
1202 {
1203 int y = 0,my = 16;
1204 if(by == 0)
1205 y = 1;
1206 if(int(by) == y_max - 1)
1207 my = 15;
1208 for(; y < my; y++)
1209 {
1210 df::tile_designation & des = bl->designation[x][y];
1211 df::tiletype tt = bl->tiletype[x][y];
1212 // could be potentially used to locate hidden constructions?
1213 if(tileMaterial(tt) == tiletype_material::CONSTRUCTION && !des.bits.hidden)
1214 continue;
1215 if(!isWallTerrain(tt) && !des.bits.hidden)
1216 continue;
1217 if(how == EXPLO_CLEAR)
1218 {
1219 des.bits.dig = tile_dig_designation::No;
1220 continue;
1221 }
1222 if(dm[y][x])
1223 {
1224 if(what == EXPLO_ALL
1225 || (des.bits.dig == tile_dig_designation::Default && what == EXPLO_DESIGNATED)
1226 || (des.bits.hidden && what == EXPLO_HIDDEN))
1227 {
1228 des.bits.dig = tile_dig_designation::Default;
1229 }
1230 }
1231 else if(what == EXPLO_DESIGNATED)
1232 {
1233 des.bits.dig = tile_dig_designation::No;
1234 }
1235 }
1236 }
1237 bl->flags.bits.designated = true;
1238 return true;
1239};
1240
1241command_result digexp (color_ostream &out, vector <string> & parameters)
1242{

Callers 1

digexpFunction · 0.85

Calls 3

getBlockFunction · 0.85
tileMaterialFunction · 0.85
isWallTerrainFunction · 0.85

Tested by

no test coverage detected