… | |
… | |
197 | |
197 | |
198 | /* This is a one of the many items on the list should be generated. |
198 | /* This is a one of the many items on the list should be generated. |
199 | * Add up the chance total, and check to make sure the yes & no |
199 | * Add up the chance total, and check to make sure the yes & no |
200 | * fields of the treasures are not being used. |
200 | * fields of the treasures are not being used. |
201 | */ |
201 | */ |
202 | tl->total_chance = 0; |
|
|
203 | |
|
|
204 | if (one) |
202 | if (one) |
205 | { |
203 | { |
206 | for (treasure *t = tl->items; t; t = t->next) |
204 | for (treasure *t = tl->items; t; t = t->next) |
207 | { |
205 | { |
208 | if (t->next_yes || t->next_no) |
206 | if (t->next_yes || t->next_no) |
… | |
… | |
398 | if (tries++ > 100) |
396 | if (tries++ > 100) |
399 | { |
397 | { |
400 | LOG (llevDebug, "createtreasure: tries exceeded 100, returning without making treasure\n"); |
398 | LOG (llevDebug, "createtreasure: tries exceeded 100, returning without making treasure\n"); |
401 | return; |
399 | return; |
402 | } |
400 | } |
|
|
401 | |
|
|
402 | if (op->flag [FLAG_TREASURE_ENV]) |
|
|
403 | flag |= GT_ENVIRONMENT; |
403 | |
404 | |
404 | if (tl->total_chance) |
405 | if (tl->total_chance) |
405 | create_one_treasure (tl, op, flag, difficulty, tries); |
406 | create_one_treasure (tl, op, flag, difficulty, tries); |
406 | else |
407 | else |
407 | create_all_treasures (tl->items, op, flag, difficulty, tries); |
408 | create_all_treasures (tl->items, op, flag, difficulty, tries); |