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

Function ChangeSameBlockVeins

plugins/changevein.cpp:100–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98};
99
100static void ChangeSameBlockVeins(df::map_block* block, df::block_square_event_mineralst* event, VeinEdgeBitmask& mask, int32_t matIndex)
101{
102 for (auto evt : block->block_events)
103 {
104 if (evt == event)
105 continue;
106 if (evt->getType() != block_square_event_type::mineral)
107 continue;
108
109 df::block_square_event_mineralst* cur = (df::block_square_event_mineralst*)evt;
110 if (cur->inorganic_mat == mask.mat)
111 {
112 for (uint8_t j = 0; j < 15; j++)
113 {
114 uint16_t bitmask = cur->tile_bitmask.bits[j] | cur->tile_bitmask.bits[(j>0 ? j-1 : 0)] | cur->tile_bitmask.bits[std::min(j + 1, 15)];
115 bitmask |= (bitmask << 1) | (bitmask >> 1);
116
117 if (bitmask & event->tile_bitmask.bits[j])
118 {
119 mask.Merge(cur);
120 cur->inorganic_mat = matIndex;
121 break;
122 }
123 }
124 }
125 }
126}
127
128static void ChangeSurroundingBlockVeins(df::map_block* block, VeinEdgeBitmask& mask, int32_t matIndex)
129{

Callers 2

df_changeveinFunction · 0.85

Calls 2

getTypeMethod · 0.80
MergeMethod · 0.45

Tested by

no test coverage detected