- bugfix broken subset-selection

- bugfix lighthouse-update
This commit is contained in:
Enno Rehling 2005-12-11 15:39:53 +00:00
parent b2bd092252
commit d187097fad
2 changed files with 10 additions and 6 deletions

View File

@ -141,7 +141,7 @@ equip_unit(struct unit * u, const struct equipment * eq)
int i;
for (i=0;eq->subsets[i].sets;++i) {
if (chance(eq->subsets[i].chance)) {
float rnd = 1000.0f / (1+rand() % 1000);
float rnd = (1+rand() % 1000) / 1000.0f;
int k;
for (k=0;eq->subsets[i].sets[k].set;++k) {
if (rnd<=eq->subsets[i].sets[k].chance) {
@ -172,7 +172,7 @@ equip_items(struct item ** items, const struct equipment * eq)
int i;
for (i=0;eq->subsets[i].sets;++i) {
if (chance(eq->subsets[i].chance)) {
float rnd = 1000.0f / (1+rand() % 1000);
float rnd = (1+rand() % 1000) / 1000.0f;
int k;
for (k=0;eq->subsets[i].sets[k].set;++k) {
if (rnd<=eq->subsets[i].sets[k].chance) {

View File

@ -1172,11 +1172,15 @@ update_lighthouse(building * lh)
region * r = lh->region;
short d = (short)log10(lh->size) + 1;
short x, y;
static const struct building_type * bt_lighthouse;
if (!bt_lighthouse) bt_lighthouse = bt_find("lighthouse");
assert(bt_lighthouse);
static boolean init_lighthouse = false;
static const struct building_type * bt_lighthouse = 0;
if (lh->type!=bt_lighthouse) return;
if (!init_lighthouse) {
bt_lighthouse = bt_find("lighthouse");
init_lighthouse = true;
}
if (bt_lighthouse==NULL || lh->type!=bt_lighthouse) return;
for (x=-d;x<=d;++x) {
for (y=-d;y<=d;++y) {