… | |
… | |
94 | if (!op->has_random_items ()) |
94 | if (!op->has_random_items ()) |
95 | return 0; |
95 | return 0; |
96 | do |
96 | do |
97 | { |
97 | { |
98 | i = 10; /* let's give it 10 tries */ |
98 | i = 10; /* let's give it 10 tries */ |
|
|
99 | |
99 | while ((tmp = generate_treasure (op->randomitems, op->stats.exp ? op->stats.exp : 5)) == NULL && --i); |
100 | while (!(tmp = generate_treasure (op->randomitems, op->stats.exp ? op->stats.exp : 5)) |
|
|
101 | && --i) |
|
|
102 | ; |
|
|
103 | |
100 | if (tmp == NULL) |
104 | if (tmp == NULL) |
101 | return 0; |
105 | return 0; |
|
|
106 | |
102 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
107 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
103 | { |
108 | { |
104 | tmp->destroy (); |
109 | tmp->destroy (true); |
105 | tmp = NULL; |
110 | tmp = NULL; |
106 | } |
111 | } |
107 | } |
112 | } |
108 | while (!tmp); |
113 | while (!tmp); |
109 | |
114 | |
… | |
… | |
117 | case TREASURE: |
122 | case TREASURE: |
118 | if (op->has_random_items ()) |
123 | if (op->has_random_items ()) |
119 | while ((op->stats.hp--) > 0) |
124 | while ((op->stats.hp--) > 0) |
120 | create_treasure (op->randomitems, op, GT_ENVIRONMENT, |
125 | create_treasure (op->randomitems, op, GT_ENVIRONMENT, |
121 | op->stats.exp ? op->stats.exp : op->map == NULL ? 14 : op->map->difficulty, 0); |
126 | op->stats.exp ? op->stats.exp : op->map == NULL ? 14 : op->map->difficulty, 0); |
122 | op->remove (); |
127 | |
123 | op->destroy (); |
128 | op->destroy (true); |
124 | break; |
129 | break; |
125 | } |
130 | } |
126 | |
131 | |
127 | return tmp ? 1 : 0; |
132 | return tmp ? 1 : 0; |
128 | } |
133 | } |