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

Method setVeinMaterialAt

library/modules/MapCache.cpp:342–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

340}
341
342bool MapExtras::Block::setVeinMaterialAt(df::coord2d pos, int16_t mat, df::inclusion_type type)
343{
344 using namespace df::enums::tiletype_material;
345
346 if (!block)
347 return false;
348
349 if (!basemats)
350 init_tiles(true);
351
352 pos = pos & 15;
353 auto &cur_mat = basemats->veinmat[pos.x][pos.y];
354 auto &cur_type = basemats->veintype[pos.x][pos.y];
355
356 if (cur_mat == mat && (mat < 0 || cur_type == type))
357 return true;
358
359 if (mat >= 0)
360 {
361 // Cannot allocate veins?
362 if (!df::block_square_event_mineralst::_identity.can_instantiate())
363 return false;
364
365 // Bad material?
366 if (!isStoneInorganic(mat))
367 return false;
368 }
369
370 dirty_veins = true;
371 cur_mat = mat;
372 cur_type = (uint8_t)type;
373 basemats->vein_dirty.setassignment(pos, true);
374
375 if (tileMaterial(tiles->base_tiles[pos.x][pos.y]) == MINERAL)
376 basemats->set_base_mat(tiles, pos, 0, mat);
377
378 return true;
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{

Callers 1

write_block_tilesMethod · 0.80

Calls 2

tileMaterialFunction · 0.85
set_base_matMethod · 0.80

Tested by

no test coverage detected