… | |
… | |
3654 | int i; |
3654 | int i; |
3655 | |
3655 | |
3656 | switch (op->type) |
3656 | switch (op->type) |
3657 | { |
3657 | { |
3658 | case SHOP_FLOOR: |
3658 | case SHOP_FLOOR: |
3659 | if (!HAS_RANDOM_ITEMS (op)) |
3659 | if (!op->has_random_items ()) |
3660 | return 0; |
3660 | return 0; |
3661 | |
3661 | |
3662 | do |
3662 | do |
3663 | { |
3663 | { |
3664 | i = 10; /* let's give it 10 tries */ |
3664 | i = 10; /* let's give it 10 tries */ |
… | |
… | |
3741 | { |
3741 | { |
3742 | invnext = invtmp->below; |
3742 | invnext = invtmp->below; |
3743 | |
3743 | |
3744 | if (QUERY_FLAG (invtmp, FLAG_AUTO_APPLY)) |
3744 | if (QUERY_FLAG (invtmp, FLAG_AUTO_APPLY)) |
3745 | auto_apply (invtmp); |
3745 | auto_apply (invtmp); |
3746 | else if (invtmp->type == TREASURE && HAS_RANDOM_ITEMS (invtmp)) |
3746 | else if (invtmp->type == TREASURE && invtmp->has_random_items ()) |
3747 | { |
3747 | { |
3748 | while ((invtmp->stats.hp--) > 0) |
3748 | while ((invtmp->stats.hp--) > 0) |
3749 | create_treasure (invtmp->randomitems, invtmp, 0, m->difficulty, 0); |
3749 | create_treasure (invtmp->randomitems, invtmp, 0, m->difficulty, 0); |
3750 | |
3750 | |
3751 | invtmp->randomitems = NULL; |
3751 | invtmp->randomitems = NULL; |
3752 | } |
3752 | } |
3753 | else if (invtmp && invtmp->arch |
3753 | else if (invtmp && invtmp->arch |
3754 | && invtmp->type != TREASURE && invtmp->type != SPELL && invtmp->type != CLASS && HAS_RANDOM_ITEMS (invtmp)) |
3754 | && invtmp->type != TREASURE && invtmp->type != SPELL && invtmp->type != CLASS && invtmp->has_random_items ()) |
3755 | { |
3755 | { |
3756 | create_treasure (invtmp->randomitems, invtmp, 0, m->difficulty, 0); |
3756 | create_treasure (invtmp->randomitems, invtmp, 0, m->difficulty, 0); |
3757 | /* Need to clear this so that we never try to create |
3757 | /* Need to clear this so that we never try to create |
3758 | * treasure again for this object |
3758 | * treasure again for this object |
3759 | */ |
3759 | */ |
… | |
… | |
3776 | |
3776 | |
3777 | } |
3777 | } |
3778 | |
3778 | |
3779 | if (QUERY_FLAG (tmp, FLAG_AUTO_APPLY)) |
3779 | if (QUERY_FLAG (tmp, FLAG_AUTO_APPLY)) |
3780 | auto_apply (tmp); |
3780 | auto_apply (tmp); |
3781 | else if ((tmp->type == TREASURE || (tmp->type == CONTAINER)) && HAS_RANDOM_ITEMS (tmp)) |
3781 | else if ((tmp->type == TREASURE || (tmp->type == CONTAINER)) && tmp->has_random_items ()) |
3782 | { |
3782 | { |
3783 | while ((tmp->stats.hp--) > 0) |
3783 | while ((tmp->stats.hp--) > 0) |
3784 | create_treasure (tmp->randomitems, tmp, 0, m->difficulty, 0); |
3784 | create_treasure (tmp->randomitems, tmp, 0, m->difficulty, 0); |
3785 | tmp->randomitems = NULL; |
3785 | tmp->randomitems = NULL; |
3786 | } |
3786 | } |
… | |
… | |
3801 | * This is a problem for the above objects, because they have counters |
3801 | * This is a problem for the above objects, because they have counters |
3802 | * which say how many times to make the treasure. |
3802 | * which say how many times to make the treasure. |
3803 | */ |
3803 | */ |
3804 | else if (tmp && tmp->arch && tmp->type != PLAYER |
3804 | else if (tmp && tmp->arch && tmp->type != PLAYER |
3805 | && tmp->type != TREASURE && tmp->type != SPELL |
3805 | && tmp->type != TREASURE && tmp->type != SPELL |
3806 | && tmp->type != PLAYER_CHANGER && tmp->type != CLASS && HAS_RANDOM_ITEMS (tmp)) |
3806 | && tmp->type != PLAYER_CHANGER && tmp->type != CLASS && tmp->has_random_items ()) |
3807 | { |
3807 | { |
3808 | create_treasure (tmp->randomitems, tmp, GT_APPLY, m->difficulty, 0); |
3808 | create_treasure (tmp->randomitems, tmp, GT_APPLY, m->difficulty, 0); |
3809 | tmp->randomitems = NULL; |
3809 | tmp->randomitems = NULL; |
3810 | } |
3810 | } |
3811 | } |
3811 | } |