1 | |
|
|
2 | /* |
|
|
3 | * static char *rcs_treasure_c = |
|
|
4 | * "$Id: treasure.C,v 1.18 2006/09/14 21:16:11 root Exp $"; |
|
|
5 | */ |
|
|
6 | |
|
|
7 | /* |
1 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
2 | CrossFire, A Multiplayer game for X-windows |
9 | |
3 | |
10 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
4 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
11 | Copyright (C) 1992 Frank Tore Johansen |
5 | Copyright (C) 1992 Frank Tore Johansen |
… | |
… | |
22 | |
16 | |
23 | You should have received a copy of the GNU General Public License |
17 | You should have received a copy of the GNU General Public License |
24 | along with this program; if not, write to the Free Software |
18 | along with this program; if not, write to the Free Software |
25 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | |
20 | |
27 | The authors can be reached via e-mail at crossfire-devel@real-time.com |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
28 | */ |
22 | */ |
29 | |
23 | |
30 | #define ALLOWED_COMBINATION |
24 | #define ALLOWED_COMBINATION |
31 | |
25 | |
32 | /* TREASURE_DEBUG does some checking on the treasurelists after loading. |
26 | /* TREASURE_DEBUG does some checking on the treasurelists after loading. |
… | |
… | |
464 | |
458 | |
465 | /* Don't want to free the object we are about to return */ |
459 | /* Don't want to free the object we are about to return */ |
466 | tmp = ob->inv; |
460 | tmp = ob->inv; |
467 | if (tmp != NULL) |
461 | if (tmp != NULL) |
468 | remove_ob (tmp); |
462 | remove_ob (tmp); |
|
|
463 | |
469 | if (ob->inv) |
464 | if (ob->inv) |
470 | { |
|
|
471 | LOG (llevError, "In generate treasure, created multiple objects.\n"); |
465 | LOG (llevError, "In generate treasure, created multiple objects.\n"); |
472 | } |
466 | |
473 | free_object (ob); |
467 | free_object (ob); |
474 | return tmp; |
468 | return tmp; |
475 | } |
469 | } |
476 | |
470 | |
477 | /* |
471 | /* |
… | |
… | |
1562 | op->gen_sp_armour = (op->gen_sp_armour * (change->gen_sp_armour)) / 100; |
1556 | op->gen_sp_armour = (op->gen_sp_armour * (change->gen_sp_armour)) / 100; |
1563 | |
1557 | |
1564 | op->item_power = change->item_power; |
1558 | op->item_power = change->item_power; |
1565 | |
1559 | |
1566 | for (i = 0; i < NROFATTACKS; i++) |
1560 | for (i = 0; i < NROFATTACKS; i++) |
1567 | { |
|
|
1568 | if (change->resist[i]) |
1561 | if (change->resist[i]) |
1569 | { |
|
|
1570 | op->resist[i] += change->resist[i]; |
1562 | op->resist[i] += change->resist[i]; |
1571 | } |
|
|
1572 | } |
|
|
1573 | |
1563 | |
1574 | if (change->stats.dam) |
1564 | if (change->stats.dam) |
1575 | { |
1565 | { |
1576 | if (change->stats.dam < 0) |
1566 | if (change->stats.dam < 0) |
1577 | op->stats.dam = (-change->stats.dam); |
1567 | op->stats.dam = (-change->stats.dam); |
… | |
… | |
1855 | free_artifact (at->next); |
1845 | free_artifact (at->next); |
1856 | |
1846 | |
1857 | if (at->allowed) |
1847 | if (at->allowed) |
1858 | free_charlinks (at->allowed); |
1848 | free_charlinks (at->allowed); |
1859 | |
1849 | |
1860 | at->item->free (1); |
1850 | at->item->destroy (1); |
1861 | |
1851 | |
1862 | delete at; |
1852 | delete at; |
1863 | } |
1853 | } |
1864 | |
1854 | |
1865 | void |
1855 | void |
1866 | free_artifactlist (artifactlist * al) |
1856 | free_artifactlist (artifactlist * al) |
1867 | { |
1857 | { |
1868 | artifactlist *nextal; |
1858 | artifactlist *nextal; |
1869 | |
1859 | |
1870 | for (al = first_artifactlist; al != NULL; al = nextal) |
1860 | for (al = first_artifactlist; al; al = nextal) |
1871 | { |
1861 | { |
1872 | nextal = al->next; |
1862 | nextal = al->next; |
1873 | |
1863 | |
1874 | if (al->items) |
1864 | if (al->items) |
1875 | free_artifact (al->items); |
1865 | free_artifact (al->items); |