| 98 | }; |
| 99 | |
| 100 | static 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 | |
| 128 | static void ChangeSurroundingBlockVeins(df::map_block* block, VeinEdgeBitmask& mask, int32_t matIndex) |
| 129 | { |
no test coverage detected