Petr Mrázek 2012-02-04 20:54:41 +01:00
commit cf3c5ff5d0
1 changed files with 42 additions and 22 deletions

@ -280,33 +280,53 @@ static command_result embark_prospector(DFHack::Core *c, df::viewscreen_choose_s
{ {
auto layer = geo_biome->layers[i]; auto layer = geo_biome->layers[i];
for (int z = layer->bottom_height; z <= layer->top_height; z++) layerMats[layer->mat_index].add(layer->bottom_height, 0);
int level_cnt = layer->top_height - layer->bottom_height + 1;
int layer_size = 48*48*cnt*level_cnt;
int sums[ENUM_LAST_ITEM(inclusion_type)+1] = { 0 };
for (unsigned j = 0; j < layer->vein_mat.size(); j++)
if (inclusion_type::is_valid(layer->vein_type[j]))
sums[layer->vein_type[j]] += layer->vein_unk_38[j];
for (unsigned j = 0; j < layer->vein_mat.size(); j++)
{ {
layerMats[layer->mat_index].add(z, 48*48*cnt); // TODO: find out how to estimate the real density
// this code assumes that vein_unk_38 is the weight
// used when choosing the vein material
int size = layer->vein_unk_38[j]*cnt*level_cnt;
df::inclusion_type type = layer->vein_type[j];
for (unsigned j = 0; j < layer->vein_mat.size(); j++) switch (type)
{ {
// TODO: find out how to estimate the real density case inclusion_type::VEIN:
int bias = 100; // 3 veins of 80 tiles avg
switch (layer->vein_type[j]) size = size * 80 * 3 / sums[type];
{ break;
case inclusion_type::VEIN: case inclusion_type::CLUSTER:
bias = 360; // 1 cluster of 700 tiles avg
break; size = size * 700 * 1 / sums[type];
case inclusion_type::CLUSTER: break;
bias = 1800; case inclusion_type::CLUSTER_SMALL:
break; size = size * 6 * 7 / sums[type];
case inclusion_type::CLUSTER_SMALL: break;
bias = 18; case inclusion_type::CLUSTER_ONE:
break; size = size * 1 * 5 / sums[type];
case inclusion_type::CLUSTER_ONE: break;
bias = 3; default:
break; // shouldn't actually happen
} size = cnt*level_cnt;
veinMats[layer->vein_mat[j]].add(z, layer->vein_unk_38[j]*bias*cnt/100);
} }
veinMats[layer->vein_mat[j]].add(layer->bottom_height, 0);
veinMats[layer->vein_mat[j]].add(layer->top_height, size);
layer_size -= size;
} }
layerMats[layer->mat_index].add(layer->top_height, std::max(0,layer_size));
} }
} }