| 1115 | */ |
| 1116 | |
| 1117 | bool GeoBlock::prepare_arena(int16_t basemat, NoiseFunction::Ptr fn) |
| 1118 | { |
| 1119 | arena_mask = arena_unmined = 0; |
| 1120 | arena_material = basemat; |
| 1121 | |
| 1122 | df::coord origin = pos + layer->world_pos; |
| 1123 | float x0 = float(origin.x)*16 + 0.5f, y0 = float(origin.y)*16 + 0.5f; |
| 1124 | float z = origin.z - layer->z_bias + 0.5f; |
| 1125 | |
| 1126 | fn->displace(x0, y0, z); |
| 1127 | |
| 1128 | for (int x = 0; x < 16; x++) |
| 1129 | { |
| 1130 | for (int y = 0; y < 16; y++) |
| 1131 | { |
| 1132 | if (material[x][y] != arena_material) |
| 1133 | continue; |
| 1134 | |
| 1135 | weight[x][y] = fn->eval(x0+x, y0+y, z); |
| 1136 | |
| 1137 | arena_mask |= (1<<x); |
| 1138 | if (unmined.getassignment(x,y)) |
| 1139 | arena_unmined |= (1<<x); |
| 1140 | } |
| 1141 | } |
| 1142 | |
| 1143 | return arena_mask != 0; |
| 1144 | } |
| 1145 | |
| 1146 | int GeoBlock::measure_placement(float threshold) |
| 1147 | { |
no test coverage detected