… | |
… | |
433 | * to do that. |
433 | * to do that. |
434 | */ |
434 | */ |
435 | void |
435 | void |
436 | create_treasure (treasurelist *tl, object *op, int flag, int difficulty, int tries) |
436 | create_treasure (treasurelist *tl, object *op, int flag, int difficulty, int tries) |
437 | { |
437 | { |
438 | |
|
|
439 | if (tries++ > 100) |
438 | if (tries++ > 100) |
440 | { |
439 | { |
441 | LOG (llevDebug, "createtreasure: tries exceeded 100, returning without making treasure\n"); |
440 | LOG (llevDebug, "createtreasure: tries exceeded 100, returning without making treasure\n"); |
442 | return; |
441 | return; |
443 | } |
442 | } |
|
|
443 | |
444 | if (tl->total_chance) |
444 | if (tl->total_chance) |
445 | create_one_treasure (tl, op, flag, difficulty, tries); |
445 | create_one_treasure (tl, op, flag, difficulty, tries); |
446 | else |
446 | else |
447 | create_all_treasures (tl->items, op, flag, difficulty, tries); |
447 | create_all_treasures (tl->items, op, flag, difficulty, tries); |
448 | } |
448 | } |
… | |
… | |
1401 | } |
1401 | } |
1402 | else if (sscanf (cp, "chance %d", &value)) |
1402 | else if (sscanf (cp, "chance %d", &value)) |
1403 | art->chance = (uint16) value; |
1403 | art->chance = (uint16) value; |
1404 | else if (sscanf (cp, "difficulty %d", &value)) |
1404 | else if (sscanf (cp, "difficulty %d", &value)) |
1405 | art->difficulty = (uint8) value; |
1405 | art->difficulty = (uint8) value; |
1406 | else if (!strncmp (cp, "Object", 6)) |
1406 | else if (!strncmp (cp, "Object", 6) || !strncmp (cp, "object", 6)) |
1407 | { |
1407 | { |
1408 | art->item = object::create (); |
1408 | art->item = object::create (); |
1409 | |
1409 | |
1410 | if (!load_object (thawer, art->item, 0)) |
1410 | if (!load_object (thawer, art->item, 0)) |
1411 | LOG (llevError, "Init_Artifacts: Could not load object.\n"); |
1411 | LOG (llevError, "Init_Artifacts: Could not load object.\n"); |