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

Method setStoneAt

library/modules/MapCache.cpp:381–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379}
380
381bool MapExtras::Block::setStoneAt(df::coord2d pos, df::tiletype tile, int16_t mat, df::inclusion_type type, bool force_vein, bool kill_veins)
382{
383 using namespace df::enums::tiletype_material;
384
385 if (!block)
386 return false;
387
388 if (!isStoneInorganic(mat) || !isCoreMaterial(tile))
389 return false;
390
391 if (!basemats)
392 init_tiles(true);
393
394 // Check if anything needs to be done
395 pos = pos & 15;
396 auto &cur_tile = tiles->base_tiles[pos.x][pos.y];
397 auto &cur_mattype = basemats->mat_type[pos.x][pos.y];
398 auto &cur_matidx = basemats->mat_index[pos.x][pos.y];
399
400 if (!force_vein && cur_tile == tile && cur_mattype == 0 && cur_matidx == mat)
401 return true;
402
403 bool vein = false;
404
405 if (force_vein && type != inclusion_type::CLUSTER)
406 vein = true;
407 else if (mat == lavaStoneAt(pos))
408 tile = matchTileMaterial(tile, LAVA_STONE);
409 else if (mat == layerMaterialAt(pos))
410 tile = matchTileMaterial(tile, STONE);
411 else
412 vein = true;
413
414 if (vein)
415 tile = matchTileMaterial(tile, MINERAL);
416
417 if (tile == tiletype::Void)
418 return false;
419 if ((vein || kill_veins) && !setVeinMaterialAt(pos, vein ? mat : -1, type))
420 return false;
421
422 if (cur_tile != tile)
423 {
424 dirty_tiles = true;
425 tiles->set_base_tile(pos, tile);
426 }
427
428 basemats->set_base_mat(tiles, pos, 0, mat);
429
430 return true;
431}
432
433bool MapExtras::Block::setSoilAt(df::coord2d pos, df::tiletype tile, bool kill_veins)
434{

Callers 3

write_block_tilesMethod · 0.80
paintTileProcessingFunction · 0.80
dig_typeFunction · 0.80

Calls 5

isCoreMaterialFunction · 0.85
lavaStoneAtFunction · 0.85
layerMaterialAtFunction · 0.85
set_base_tileMethod · 0.80
set_base_matMethod · 0.80

Tested by

no test coverage detected