1 | /* |
1 | /* |
2 | * CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game |
3 | * |
3 | * |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
7 | * |
7 | * |
… | |
… | |
230 | * start with equipment, but only their abilities). |
230 | * start with equipment, but only their abilities). |
231 | */ |
231 | */ |
232 | static void |
232 | static void |
233 | put_treasure (object *op, object *creator, int flags) |
233 | put_treasure (object *op, object *creator, int flags) |
234 | { |
234 | { |
|
|
235 | if (flags & GT_ENVIRONMENT) |
|
|
236 | { |
235 | /* Bit of a hack - spells should never be put onto the map. The entire |
237 | /* Bit of a hack - spells should never be put onto the map. The entire |
236 | * treasure stuff is a problem - there is no clear idea of knowing |
238 | * treasure stuff is a problem - there is no clear idea of knowing |
237 | * this is the original object, or if this is an object that should be created |
239 | * this is the original object, or if this is an object that should be created |
238 | * by another object. |
240 | * by another object. |
239 | */ |
241 | */ |
240 | if (flags & GT_ENVIRONMENT && op->type != SPELL) |
242 | //TODO: flag such as objects... as such (no drop, anybody?) |
241 | { |
243 | if (op->type == SPELL) |
|
|
244 | { |
|
|
245 | op->destroy (); |
|
|
246 | return; |
|
|
247 | } |
|
|
248 | |
242 | op->expand_tail (); |
249 | op->expand_tail (); |
243 | |
250 | |
244 | if (ob_blocked (op, creator->map, creator->x, creator->y)) |
251 | if (ob_blocked (op, creator->map, creator->x, creator->y)) |
245 | op->destroy (); |
252 | op->destroy (); |
246 | else |
253 | else |
… | |
… | |
364 | fix_generated_item (tmp, op, difficulty, t->magic, flag); |
371 | fix_generated_item (tmp, op, difficulty, t->magic, flag); |
365 | change_treasure (t, tmp); |
372 | change_treasure (t, tmp); |
366 | put_treasure (tmp, op, flag); |
373 | put_treasure (tmp, op, flag); |
367 | } |
374 | } |
368 | } |
375 | } |
|
|
376 | } |
|
|
377 | |
|
|
378 | void |
|
|
379 | object::create_treasure (treasurelist *tl, int flags) |
|
|
380 | { |
|
|
381 | ::create_treasure (tl, this, flags, map ? map->difficulty : 0); |
369 | } |
382 | } |
370 | |
383 | |
371 | /* This calls the appropriate treasure creation function. tries is passed |
384 | /* This calls the appropriate treasure creation function. tries is passed |
372 | * to determine how many list transitions or attempts to create treasure |
385 | * to determine how many list transitions or attempts to create treasure |
373 | * have been made. It is really in place to prevent infinite loops with |
386 | * have been made. It is really in place to prevent infinite loops with |