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

Method prepare_arena

plugins/3dveins.cpp:1117–1144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1115 */
1116
1117bool 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
1146int GeoBlock::measure_placement(float threshold)
1147{

Callers 1

place_tilesMethod · 0.80

Calls 2

displaceMethod · 0.80
evalMethod · 0.45

Tested by

no test coverage detected