… | |
… | |
157 | } |
157 | } |
158 | } |
158 | } |
159 | } |
159 | } |
160 | break; |
160 | break; |
161 | } |
161 | } |
|
|
162 | |
162 | default: |
163 | default: |
163 | { |
164 | { |
164 | int i, j, tries; |
165 | int i, j, tries; |
165 | object *chest; |
166 | object *chest; |
166 | object **doorlist; |
167 | object **doorlist; |
… | |
… | |
264 | |
265 | |
265 | /* stick a trap in the chest if required */ |
266 | /* stick a trap in the chest if required */ |
266 | if (treasureoptions & TRAPPED) |
267 | if (treasureoptions & TRAPPED) |
267 | { |
268 | { |
268 | maptile *trap_map = find_style ("/styles/trapstyles", "traps", -1); |
269 | maptile *trap_map = find_style ("/styles/trapstyles", "traps", -1); |
269 | object *the_trap; |
|
|
270 | |
270 | |
271 | if (trap_map) |
271 | if (trap_map) |
272 | { |
272 | { |
273 | the_trap = trap_map->pick_random_object (); |
273 | object *the_trap = trap_map->pick_random_object (); |
|
|
274 | |
274 | the_trap->stats.Cha = 10 + RP->difficulty; |
275 | the_trap->stats.Cha = 10 + RP->difficulty; |
275 | the_trap->level = bc_random ((3 * RP->difficulty) / 2); |
276 | the_trap->level = bc_random ((3 * RP->difficulty) / 2); |
|
|
277 | |
276 | if (the_trap) |
278 | if (the_trap) |
277 | { |
279 | { |
278 | object *new_trap; |
280 | object *new_trap = the_trap->arch->instance ();//TODO: why not clone? |
279 | |
281 | |
280 | new_trap = arch_to_object (the_trap->arch); |
|
|
281 | new_trap->copy_to (the_trap); |
|
|
282 | new_trap->x = x; |
282 | new_trap->x = x; |
283 | new_trap->y = y; |
283 | new_trap->y = y; |
284 | insert_ob_in_ob (new_trap, the_chest); |
284 | insert_ob_in_ob (new_trap, the_chest); |
285 | } |
285 | } |
286 | } |
286 | } |