Modify embark-time prospect using the randomized material hypothesis.

Assume that the game generates a fixed number of veins of each
type, but randomly chooses the material, using unk_38 as weight.
This seems to bring some numbers closer to the real counts.
develop
Alexander Gavrilov 2012-02-03 12:48:38 +04:00
parent d4163fcde3
commit 6bf55978a4
1 changed files with 21 additions and 8 deletions

@ -285,28 +285,41 @@ static command_result embark_prospector(DFHack::Core *c, df::viewscreen_choose_s
int level_cnt = layer->top_height - layer->bottom_height + 1; int level_cnt = layer->top_height - layer->bottom_height + 1;
int layer_size = 48*48*cnt*level_cnt; 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++) for (unsigned j = 0; j < layer->vein_mat.size(); j++)
{ {
// TODO: find out how to estimate the real density // TODO: find out how to estimate the real density
int bias = 100; // this code assumes that vein_unk_38 is the weight
switch (layer->vein_type[j]) // used when choosing the vein material
int size = layer->vein_unk_38[j]*cnt*level_cnt;
df::inclusion_type type = layer->vein_type[j];
switch (type)
{ {
case inclusion_type::VEIN: case inclusion_type::VEIN:
bias = 200; // 3 veins of 80 tiles avg
size = size * 80 * 3 / sums[type];
break; break;
case inclusion_type::CLUSTER: case inclusion_type::CLUSTER:
bias = 1000; // 1 cluster of 700 tiles avg
size = size * 700 * 1 / sums[type];
break; break;
case inclusion_type::CLUSTER_SMALL: case inclusion_type::CLUSTER_SMALL:
bias = 15; size = size * 6 * 7 / sums[type];
break; break;
case inclusion_type::CLUSTER_ONE: case inclusion_type::CLUSTER_ONE:
bias = 2; size = size * 1 * 5 / sums[type];
break; break;
default:
// shouldn't actually happen
size = cnt*level_cnt;
} }
int size = layer->vein_unk_38[j]*bias*cnt*level_cnt/100;
veinMats[layer->vein_mat[j]].add(layer->bottom_height, 0); veinMats[layer->vein_mat[j]].add(layer->bottom_height, 0);
veinMats[layer->vein_mat[j]].add(layer->top_height, size); veinMats[layer->vein_mat[j]].add(layer->top_height, size);