1 | |
1 | |
2 | /* |
2 | /* |
3 | * static char *rcs_treasure_c = |
3 | * static char *rcs_treasure_c = |
4 | * "$Id: treasure.C,v 1.13 2006/09/05 17:58:11 root Exp $"; |
4 | * "$Id: treasure.C,v 1.15 2006/09/09 21:48:28 root Exp $"; |
5 | */ |
5 | */ |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
9 | |
9 | |
… | |
… | |
526 | */ |
526 | */ |
527 | |
527 | |
528 | int |
528 | int |
529 | level_for_item (const object * op, int difficulty) |
529 | level_for_item (const object * op, int difficulty) |
530 | { |
530 | { |
531 | int mult = 0, olevel = 0; |
531 | int olevel = 0; |
532 | |
532 | |
533 | if (!op->inv) |
533 | if (!op->inv) |
534 | { |
534 | { |
535 | LOG (llevError, "level_for_item: Object %s has no inventory!\n", &op->name); |
535 | LOG (llevError, "level_for_item: Object %s has no inventory!\n", &op->name); |
536 | return 0; |
536 | return 0; |
… | |
… | |
1325 | { |
1325 | { |
1326 | static int has_been_inited = 0; |
1326 | static int has_been_inited = 0; |
1327 | char filename[MAX_BUF], buf[HUGE_BUF], *cp, *next; |
1327 | char filename[MAX_BUF], buf[HUGE_BUF], *cp, *next; |
1328 | artifact *art = NULL; |
1328 | artifact *art = NULL; |
1329 | linked_char *tmp; |
1329 | linked_char *tmp; |
1330 | int value, comp; |
1330 | int value; |
1331 | artifactlist *al; |
1331 | artifactlist *al; |
1332 | |
1332 | |
1333 | if (has_been_inited) |
1333 | if (has_been_inited) |
1334 | return; |
1334 | return; |
1335 | else |
1335 | else |
… | |
… | |
1428 | */ |
1428 | */ |
1429 | |
1429 | |
1430 | void |
1430 | void |
1431 | add_abilities (object * op, object * change) |
1431 | add_abilities (object * op, object * change) |
1432 | { |
1432 | { |
1433 | int i, j, tmp; |
1433 | int i, tmp; |
1434 | |
1434 | |
1435 | if (change->face != blank_face) |
1435 | if (change->face != blank_face) |
1436 | { |
1436 | { |
1437 | #ifdef TREASURE_VERBOSE |
1437 | #ifdef TREASURE_VERBOSE |
1438 | LOG (llevDebug, "FACE: %d\n", change->face->number); |
1438 | LOG (llevDebug, "FACE: %d\n", change->face->number); |
… | |
… | |
1835 | } |
1835 | } |
1836 | |
1836 | |
1837 | void |
1837 | void |
1838 | free_artifact (artifact * at) |
1838 | free_artifact (artifact * at) |
1839 | { |
1839 | { |
1840 | |
|
|
1841 | if (at->next) |
1840 | if (at->next) |
1842 | free_artifact (at->next); |
1841 | free_artifact (at->next); |
|
|
1842 | |
1843 | if (at->allowed) |
1843 | if (at->allowed) |
1844 | free_charlinks (at->allowed); |
1844 | free_charlinks (at->allowed); |
1845 | |
1845 | |
1846 | delete at->item; |
1846 | at->item->free (1); |
1847 | |
1847 | |
1848 | delete at; |
1848 | delete at; |
1849 | } |
1849 | } |
1850 | |
1850 | |
1851 | void |
1851 | void |
1852 | free_artifactlist (artifactlist * al) |
1852 | free_artifactlist (artifactlist * al) |
1853 | { |
1853 | { |
1854 | artifactlist *nextal; |
1854 | artifactlist *nextal; |
|
|
1855 | |
1855 | for (al = first_artifactlist; al != NULL; al = nextal) |
1856 | for (al = first_artifactlist; al != NULL; al = nextal) |
1856 | { |
1857 | { |
1857 | nextal = al->next; |
1858 | nextal = al->next; |
|
|
1859 | |
1858 | if (al->items) |
1860 | if (al->items) |
1859 | { |
|
|
1860 | free_artifact (al->items); |
1861 | free_artifact (al->items); |
1861 | } |
1862 | |
1862 | free (al); |
1863 | free (al); |
1863 | } |
1864 | } |
1864 | } |
1865 | } |
1865 | |
1866 | |
1866 | void |
1867 | void |