1 | |
1 | |
2 | /* |
2 | /* |
3 | * static char *rcs_treasure_c = |
3 | * static char *rcs_treasure_c = |
4 | * "$Id: treasure.C,v 1.7 2006/09/03 00:18:40 root Exp $"; |
4 | * "$Id: treasure.C,v 1.11 2006/09/04 11:07:59 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 | |
… | |
… | |
121 | { |
121 | { |
122 | if ((t->item = find_archetype (variable)) == NULL) |
122 | if ((t->item = find_archetype (variable)) == NULL) |
123 | LOG (llevError, "Treasure lacks archetype: %s\n", variable); |
123 | LOG (llevError, "Treasure lacks archetype: %s\n", variable); |
124 | } |
124 | } |
125 | else if (sscanf (cp, "list %s", variable)) |
125 | else if (sscanf (cp, "list %s", variable)) |
126 | t->name = variable; |
126 | t->name = variable; |
127 | else if (sscanf (cp, "change_name %s", variable)) |
127 | else if (sscanf (cp, "change_name %s", variable)) |
128 | t->change_arch.name = variable; |
128 | t->change_arch.name = variable; |
129 | else if (sscanf (cp, "change_title %s", variable)) |
129 | else if (sscanf (cp, "change_title %s", variable)) |
130 | t->change_arch.title = variable; |
130 | t->change_arch.title = variable; |
131 | else if (sscanf (cp, "change_slaying %s", variable)) |
131 | else if (sscanf (cp, "change_slaying %s", variable)) |
… | |
… | |
268 | if (!name || !*name) |
268 | if (!name || !*name) |
269 | return NULL; |
269 | return NULL; |
270 | |
270 | |
271 | if (tmp != NULL) |
271 | if (tmp != NULL) |
272 | for (tl = first_treasurelist; tl != NULL; tl = tl->next) |
272 | for (tl = first_treasurelist; tl != NULL; tl = tl->next) |
|
|
273 | { |
273 | if (tmp == tl->name) |
274 | if (tmp == tl->name) |
274 | return tl; |
275 | return tl; |
|
|
276 | } |
275 | |
277 | |
|
|
278 | if (first_treasurelist) |
276 | LOG (llevError, "Couldn't find treasurelist %s\n", name); |
279 | LOG (llevError, "Couldn't find treasurelist %s(%s)\n", name, tmp); |
|
|
280 | |
277 | return NULL; |
281 | return NULL; |
278 | } |
282 | } |
279 | |
283 | |
280 | |
284 | |
281 | /* |
285 | /* |
… | |
… | |
1371 | art->chance = (uint16) value; |
1375 | art->chance = (uint16) value; |
1372 | else if (sscanf (cp, "difficulty %d", &value)) |
1376 | else if (sscanf (cp, "difficulty %d", &value)) |
1373 | art->difficulty = (uint8) value; |
1377 | art->difficulty = (uint8) value; |
1374 | else if (!strncmp (cp, "Object", 6)) |
1378 | else if (!strncmp (cp, "Object", 6)) |
1375 | { |
1379 | { |
1376 | art->item = (object *) calloc (1, sizeof (object)); |
1380 | art->item = get_object (); |
1377 | reset_object (art->item); |
1381 | |
1378 | if (!load_object (thawer, art->item, LO_LINEMODE, 0)) |
1382 | if (!load_object (thawer, art->item, 0)) |
1379 | LOG (llevError, "Init_Artifacts: Could not load object.\n"); |
1383 | LOG (llevError, "Init_Artifacts: Could not load object.\n"); |
|
|
1384 | |
1380 | art->item->name = strchr (cp, ' ') + 1; |
1385 | art->item->name = strchr (cp, ' ') + 1; |
1381 | al = find_artifactlist (art->item->type); |
1386 | al = find_artifactlist (art->item->type); |
1382 | if (al == NULL) |
1387 | if (al == NULL) |
1383 | { |
1388 | { |
1384 | al = get_empty_artifactlist (); |
1389 | al = get_empty_artifactlist (); |
… | |
… | |
1808 | free_treasurestruct (t->next); |
1813 | free_treasurestruct (t->next); |
1809 | if (t->next_yes) |
1814 | if (t->next_yes) |
1810 | free_treasurestruct (t->next_yes); |
1815 | free_treasurestruct (t->next_yes); |
1811 | if (t->next_no) |
1816 | if (t->next_no) |
1812 | free_treasurestruct (t->next_no); |
1817 | free_treasurestruct (t->next_no); |
1813 | free (t); |
1818 | |
|
|
1819 | delete t; |
1814 | } |
1820 | } |
1815 | |
1821 | |
1816 | void |
1822 | void |
1817 | free_charlinks (linked_char * lc) |
1823 | free_charlinks (linked_char * lc) |
1818 | { |
1824 | { |