ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/treasure.C
(Generate patch)

Comparing deliantra/server/common/treasure.C (file contents):
Revision 1.16 by root, Sun Sep 10 16:00:23 2006 UTC vs.
Revision 1.30 by elmex, Wed Jan 3 02:30:51 2007 UTC

1
2/*
3 * static char *rcs_treasure_c =
4 * "$Id: treasure.C,v 1.16 2006/09/10 16:00:23 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.
58{ 52{
59 int prev_warn = warn_archetypes; 53 int prev_warn = warn_archetypes;
60 54
61 warn_archetypes = 1; 55 warn_archetypes = 1;
62 if (ring_arch == NULL) 56 if (ring_arch == NULL)
63 ring_arch = find_archetype ("ring"); 57 ring_arch = archetype::find ("ring");
64 if (amulet_arch == NULL) 58 if (amulet_arch == NULL)
65 amulet_arch = find_archetype ("amulet"); 59 amulet_arch = archetype::find ("amulet");
66 if (staff_arch == NULL) 60 if (staff_arch == NULL)
67 staff_arch = find_archetype ("staff"); 61 staff_arch = archetype::find ("staff");
68 if (crown_arch == NULL) 62 if (crown_arch == NULL)
69 crown_arch = find_archetype ("crown"); 63 crown_arch = archetype::find ("crown");
70 warn_archetypes = prev_warn; 64 warn_archetypes = prev_warn;
71} 65}
72 66
73/* 67/*
74 * Allocate and return the pointer to an empty treasurelist structure. 68 * Allocate and return the pointer to an empty treasurelist structure.
119 while (isspace (*cp)) /* Skip blanks */ 113 while (isspace (*cp)) /* Skip blanks */
120 cp++; 114 cp++;
121 115
122 if (sscanf (cp, "arch %s", variable)) 116 if (sscanf (cp, "arch %s", variable))
123 { 117 {
124 if ((t->item = find_archetype (variable)) == NULL) 118 if ((t->item = archetype::find (variable)) == NULL)
125 LOG (llevError, "Treasure lacks archetype: %s\n", variable); 119 LOG (llevError, "Treasure lacks archetype: %s\n", variable);
126 } 120 }
127 else if (sscanf (cp, "list %s", variable)) 121 else if (sscanf (cp, "list %s", variable))
128 t->name = variable; 122 t->name = variable;
129 else if (sscanf (cp, "change_name %s", variable)) 123 else if (sscanf (cp, "change_name %s", variable))
162 * so that the treasure name can be printed out 156 * so that the treasure name can be printed out
163 */ 157 */
164static void 158static void
165check_treasurelist (const treasure *t, const treasurelist * tl) 159check_treasurelist (const treasure *t, const treasurelist * tl)
166{ 160{
167 if (t->item == NULL && t->name == NULL)
168 LOG (llevError, "Treasurelist %s has element with no name or archetype\n", &tl->name);
169 if (t->chance >= 100 && t->next_yes && (t->next || t->next_no)) 161 if (t->chance >= 100 && t->next_yes && (t->next || t->next_no))
170 LOG (llevError, "Treasurelist %s has element that has 100%% generation, next_yes field as well as next or next_no\n", &tl->name); 162 LOG (llevError, "Treasurelist %s has element that has 100%% generation, next_yes field as well as next or next_no\n", &tl->name);
171 /* find_treasurelist will print out its own error message */ 163 /* find_treasurelist will print out its own error message */
172 if (t->name && *t->name) 164 if (t->name && *t->name)
173 (void) find_treasurelist (t->name); 165 find_treasurelist (t->name);
174 if (t->next) 166 if (t->next)
175 check_treasurelist (t->next, tl); 167 check_treasurelist (t->next, tl);
176 if (t->next_yes) 168 if (t->next_yes)
177 check_treasurelist (t->next_yes, tl); 169 check_treasurelist (t->next_yes, tl);
178 if (t->next_no) 170 if (t->next_no)
259 */ 251 */
260 252
261treasurelist * 253treasurelist *
262find_treasurelist (const char *name) 254find_treasurelist (const char *name)
263{ 255{
264 /* Special cases - randomitems of NULL is to override default. If 256 shstr_cmp name_ (name);
265 * first_treasurelist is null, it means we are on the first pass of 257
266 * of loading archetypes, so for now, just return - second pass will
267 * init these values.
268 */
269 if (!name) 258 if (!name_)
270 return 0; 259 return 0;
271 260
272 if (const char *tmp = shstr::find (name))
273 for (treasurelist * tl = first_treasurelist; tl != 0; tl = tl->next) 261 for (treasurelist *tl = first_treasurelist; tl != 0; tl = tl->next)
274 if (tmp == tl->name) 262 if (name_ == tl->name)
275 return tl; 263 return tl;
276 264
277 if (first_treasurelist) 265 if (first_treasurelist)
278 LOG (llevError, "Couldn't find treasurelist %s\n", name); 266 LOG (llevError, "Couldn't find treasurelist %s\n", name);
279 267
280 return 0; 268 return 0;
290 * being generated. 278 * being generated.
291 * If flag is GT_INVISIBLE, only invisible objects are generated (ie, only 279 * If flag is GT_INVISIBLE, only invisible objects are generated (ie, only
292 * abilities. This is used by summon spells, thus no summoned monsters 280 * abilities. This is used by summon spells, thus no summoned monsters
293 * start with equipment, but only their abilities). 281 * start with equipment, but only their abilities).
294 */ 282 */
295
296
297static void 283static void
298put_treasure (object *op, object *creator, int flags) 284put_treasure (object *op, object *creator, int flags)
299{ 285{
300 object *tmp; 286 object *tmp;
301 287
304 * this is the original object, or if this is an object that should be created 290 * this is the original object, or if this is an object that should be created
305 * by another object. 291 * by another object.
306 */ 292 */
307 if (flags & GT_ENVIRONMENT && op->type != SPELL) 293 if (flags & GT_ENVIRONMENT && op->type != SPELL)
308 { 294 {
309 op->x = creator->x;
310 op->y = creator->y;
311 SET_FLAG (op, FLAG_OBJ_ORIGINAL); 295 SET_FLAG (op, FLAG_OBJ_ORIGINAL);
312 insert_ob_in_map (op, creator->map, op, INS_NO_MERGE | INS_NO_WALK_ON); 296 op->insert_at (creator, creator, INS_NO_MERGE | INS_NO_WALK_ON);
313 } 297 }
314 else 298 else
315 { 299 {
316 op = insert_ob_in_ob (op, creator); 300 op = creator->insert (op);
301
317 if ((flags & GT_APPLY) && QUERY_FLAG (creator, FLAG_MONSTER)) 302 if ((flags & GT_APPLY) && QUERY_FLAG (creator, FLAG_MONSTER))
318 monster_check_apply (creator, op); 303 monster_check_apply (creator, op);
304
319 if ((flags & GT_UPDATE_INV) && (tmp = is_player_inv (creator)) != NULL) 305 if ((flags & GT_UPDATE_INV) && (tmp = creator->in_player ()))
320 esrv_send_item (tmp, op); 306 esrv_send_item (tmp, op);
321 } 307 }
322} 308}
323 309
324/* if there are change_xxx commands in the treasure, we include the changes 310/* if there are change_xxx commands in the treasure, we include the changes
348 334
349 if ((int) t->chance >= 100 || (RANDOM () % 100 + 1) < (int) t->chance) 335 if ((int) t->chance >= 100 || (RANDOM () % 100 + 1) < (int) t->chance)
350 { 336 {
351 if (t->name) 337 if (t->name)
352 { 338 {
353 if (strcmp (t->name, "NONE") && difficulty >= t->magic) 339 if (difficulty >= t->magic)
340 {
341 treasurelist *tl = find_treasurelist (t->name);
342 if (tl)
354 create_treasure (find_treasurelist (t->name), op, flag, difficulty, tries); 343 create_treasure (tl, op, flag, difficulty, tries);
344 }
355 } 345 }
356 else 346 else
357 { 347 {
358 if (t->item->clone.invisible != 0 || !(flag & GT_INVISIBLE)) 348 if (t->item && (t->item->clone.invisible != 0 || !(flag & GT_INVISIBLE)))
359 { 349 {
360 tmp = arch_to_object (t->item); 350 tmp = arch_to_object (t->item);
361 if (t->nrof && tmp->nrof <= 1) 351 if (t->nrof && tmp->nrof <= 1)
362 tmp->nrof = RANDOM () % ((int) t->nrof) + 1; 352 tmp->nrof = RANDOM () % ((int) t->nrof) + 1;
363 fix_generated_item (tmp, op, difficulty, t->magic, flag); 353 fix_generated_item (tmp, op, difficulty, t->magic, flag);
403 return; 393 return;
404 } 394 }
405 395
406 if (t->name) 396 if (t->name)
407 { 397 {
408 if (!strcmp (t->name, "NONE"))
409 return;
410
411 if (difficulty >= t->magic) 398 if (difficulty >= t->magic)
399 {
400 treasurelist *tl = find_treasurelist (t->name);
401 if (tl)
412 create_treasure (find_treasurelist (t->name), op, flag, difficulty, tries); 402 create_treasure (tl, op, flag, difficulty, tries);
403 }
413 else if (t->nrof) 404 else if (t->nrof)
414 create_one_treasure (tl, op, flag, difficulty, tries); 405 create_one_treasure (tl, op, flag, difficulty, tries);
415 406
416 return; 407 return;
417 } 408 }
418 409
419 if ((t->item && t->item->clone.invisible != 0) || flag != GT_INVISIBLE) 410 if (t->item && (t->item->clone.invisible != 0 || flag != GT_INVISIBLE))
420 { 411 {
421 object *tmp = arch_to_object (t->item); 412 object *tmp = arch_to_object (t->item);
422 413
423 if (!tmp) 414 if (!tmp)
424 return; 415 return;
438 * list transitions, or so that excessively good treasure will not be 429 * list transitions, or so that excessively good treasure will not be
439 * created on weak maps, because it will exceed the number of allowed tries 430 * created on weak maps, because it will exceed the number of allowed tries
440 * to do that. 431 * to do that.
441 */ 432 */
442void 433void
443create_treasure (treasurelist * t, object *op, int flag, int difficulty, int tries) 434create_treasure (treasurelist *tl, object *op, int flag, int difficulty, int tries)
444{ 435{
445 436
446 if (tries++ > 100) 437 if (tries++ > 100)
447 { 438 {
448 LOG (llevDebug, "createtreasure: tries exceeded 100, returning without making treasure\n"); 439 LOG (llevDebug, "createtreasure: tries exceeded 100, returning without making treasure\n");
449 return; 440 return;
450 } 441 }
451 if (t->total_chance) 442 if (tl->total_chance)
452 create_one_treasure (t, op, flag, difficulty, tries); 443 create_one_treasure (tl, op, flag, difficulty, tries);
453 else 444 else
454 create_all_treasures (t->items, op, flag, difficulty, tries); 445 create_all_treasures (tl->items, op, flag, difficulty, tries);
455} 446}
456 447
457/* This is similar to the old generate treasure function. However, 448/* This is similar to the old generate treasure function. However,
458 * it instead takes a treasurelist. It is really just a wrapper around 449 * it instead takes a treasurelist. It is really just a wrapper around
459 * create_treasure. We create a dummy object that the treasure gets 450 * create_treasure. We create a dummy object that the treasure gets
460 * inserted into, and then return that treausre 451 * inserted into, and then return that treausre
461 */ 452 */
462object * 453object *
463generate_treasure (treasurelist * t, int difficulty) 454generate_treasure (treasurelist *tl, int difficulty)
464{ 455{
456 difficulty = clamp (difficulty, 1, settings.max_level);
457
465 object *ob = get_object (), *tmp; 458 object *ob = object::create (), *tmp;
466 459
467 create_treasure (t, ob, 0, difficulty, 0); 460 create_treasure (tl, ob, 0, difficulty, 0);
468 461
469 /* Don't want to free the object we are about to return */ 462 /* Don't want to free the object we are about to return */
470 tmp = ob->inv; 463 tmp = ob->inv;
471 if (tmp != NULL) 464 if (tmp != NULL)
472 remove_ob (tmp); 465 tmp->remove ();
466
473 if (ob->inv) 467 if (ob->inv)
474 {
475 LOG (llevError, "In generate treasure, created multiple objects.\n"); 468 LOG (llevError, "In generate treasure, created multiple objects.\n");
476 } 469
477 free_object (ob); 470 ob->destroy ();
478 return tmp; 471 return tmp;
479} 472}
480 473
481/* 474/*
482 * This is a new way of calculating the chance for an item to have 475 * This is a new way of calculating the chance for an item to have
859 } 852 }
860 853
861 if (difficulty < 1) 854 if (difficulty < 1)
862 difficulty = 1; 855 difficulty = 1;
863 856
857 if (INVOKE_OBJECT (ADD_BONUS, op,
858 ARG_OBJECT (creator != op ? creator : 0),
859 ARG_INT (difficulty), ARG_INT (max_magic),
860 ARG_INT (flags)))
861 return;
862
864 if (!(flags & GT_MINIMAL)) 863 if (!(flags & GT_MINIMAL))
865 { 864 {
866 if (op->arch == crown_arch) 865 if (op->arch == crown_arch)
867 { 866 {
868 set_magic (difficulty, op, max_magic, flags); 867 set_magic (difficulty, op, max_magic, flags);
1003 op->value *= 5; /* Since it's not just decoration */ 1002 op->value *= 5; /* Since it's not just decoration */
1004 1003
1005 case RING: 1004 case RING:
1006 if (op->arch == NULL) 1005 if (op->arch == NULL)
1007 { 1006 {
1008 remove_ob (op); 1007 op->destroy ();
1009 free_object (op);
1010 op = NULL; 1008 op = 0;
1011 break; 1009 break;
1012 } 1010 }
1013 1011
1014 if (op->arch != ring_arch && op->arch != amulet_arch) /* It's a special artifact! */ 1012 if (op->arch != ring_arch && op->arch != amulet_arch) /* It's a special artifact! */
1015 break; 1013 break;
1173 */ 1171 */
1174 1172
1175static artifactlist * 1173static artifactlist *
1176get_empty_artifactlist (void) 1174get_empty_artifactlist (void)
1177{ 1175{
1178 artifactlist *tl = (artifactlist *) malloc (sizeof (artifactlist)); 1176 artifactlist *al = (artifactlist *) malloc (sizeof (artifactlist));
1179 1177
1180 if (tl == NULL) 1178 if (al == NULL)
1181 fatal (OUT_OF_MEMORY); 1179 fatal (OUT_OF_MEMORY);
1182 tl->next = NULL; 1180 al->next = NULL;
1183 tl->items = NULL; 1181 al->items = NULL;
1184 tl->total_chance = 0; 1182 al->total_chance = 0;
1185 return tl; 1183 return al;
1186} 1184}
1187 1185
1188/* 1186/*
1189 * Allocate and return the pointer to an empty artifact structure. 1187 * Allocate and return the pointer to an empty artifact structure.
1190 */ 1188 */
1191 1189
1192static artifact * 1190static artifact *
1193get_empty_artifact (void) 1191get_empty_artifact (void)
1194{ 1192{
1195 artifact *t = (artifact *) malloc (sizeof (artifact)); 1193 artifact *a = (artifact *) malloc (sizeof (artifact));
1196 1194
1197 if (t == NULL) 1195 if (a == NULL)
1198 fatal (OUT_OF_MEMORY); 1196 fatal (OUT_OF_MEMORY);
1199 t->item = NULL; 1197 a->item = NULL;
1200 t->next = NULL; 1198 a->next = NULL;
1201 t->chance = 0; 1199 a->chance = 0;
1202 t->difficulty = 0; 1200 a->difficulty = 0;
1203 t->allowed = NULL; 1201 a->allowed = NULL;
1204 return t; 1202 return a;
1205} 1203}
1206 1204
1207/* 1205/*
1208 * Searches the artifact lists and returns one that has the same type 1206 * Searches the artifact lists and returns one that has the same type
1209 * of objects on it. 1207 * of objects on it.
1259 treasurelist *tl; 1257 treasurelist *tl;
1260 int i; 1258 int i;
1261 1259
1262 if (depth > 100) 1260 if (depth > 100)
1263 return; 1261 return;
1264 while (t != NULL) 1262 while (t)
1265 { 1263 {
1266 if (t->name != NULL) 1264 if (t->name)
1267 { 1265 {
1268 for (i = 0; i < depth; i++) 1266 for (i = 0; i < depth; i++)
1269 fprintf (logfile, " "); 1267 fprintf (logfile, " ");
1270 fprintf (logfile, "{ (list: %s)\n", &t->name); 1268 fprintf (logfile, "{ (list: %s)\n", &t->name);
1271 tl = find_treasurelist (t->name); 1269 tl = find_treasurelist (t->name);
1270 if (tl)
1272 dump_monster_treasure_rec (name, tl->items, depth + 2); 1271 dump_monster_treasure_rec (name, tl->items, depth + 2);
1273 for (i = 0; i < depth; i++) 1272 for (i = 0; i < depth; i++)
1274 fprintf (logfile, " "); 1273 fprintf (logfile, " ");
1275 fprintf (logfile, "} (end of list: %s)\n", &t->name); 1274 fprintf (logfile, "} (end of list: %s)\n", &t->name);
1276 } 1275 }
1277 else 1276 else
1278 { 1277 {
1279 for (i = 0; i < depth; i++) 1278 for (i = 0; i < depth; i++)
1280 fprintf (logfile, " "); 1279 fprintf (logfile, " ");
1281 if (t->item->clone.type == FLESH) 1280 if (t->item && t->item->clone.type == FLESH)
1282 fprintf (logfile, "%s's %s\n", name, &t->item->clone.name); 1281 fprintf (logfile, "%s's %s\n", name, &t->item->clone.name);
1283 else 1282 else
1284 fprintf (logfile, "%s\n", &t->item->clone.name); 1283 fprintf (logfile, "%s\n", &t->item->clone.name);
1285 } 1284 }
1285
1286 if (t->next_yes != NULL) 1286 if (t->next_yes)
1287 { 1287 {
1288 for (i = 0; i < depth; i++) 1288 for (i = 0; i < depth; i++)
1289 fprintf (logfile, " "); 1289 fprintf (logfile, " ");
1290 fprintf (logfile, " (if yes)\n"); 1290 fprintf (logfile, " (if yes)\n");
1291 dump_monster_treasure_rec (name, t->next_yes, depth + 1); 1291 dump_monster_treasure_rec (name, t->next_yes, depth + 1);
1292 } 1292 }
1293
1293 if (t->next_no != NULL) 1294 if (t->next_no)
1294 { 1295 {
1295 for (i = 0; i < depth; i++) 1296 for (i = 0; i < depth; i++)
1296 fprintf (logfile, " "); 1297 fprintf (logfile, " ");
1297 fprintf (logfile, " (if no)\n"); 1298 fprintf (logfile, " (if no)\n");
1298 dump_monster_treasure_rec (name, t->next_no, depth + 1); 1299 dump_monster_treasure_rec (name, t->next_no, depth + 1);
1299 } 1300 }
1301
1300 t = t->next; 1302 t = t->next;
1301 } 1303 }
1302} 1304}
1303 1305
1304/* 1306/*
1394 art->chance = (uint16) value; 1396 art->chance = (uint16) value;
1395 else if (sscanf (cp, "difficulty %d", &value)) 1397 else if (sscanf (cp, "difficulty %d", &value))
1396 art->difficulty = (uint8) value; 1398 art->difficulty = (uint8) value;
1397 else if (!strncmp (cp, "Object", 6)) 1399 else if (!strncmp (cp, "Object", 6))
1398 { 1400 {
1399 art->item = get_object (); 1401 art->item = object::create ();
1400 1402
1401 if (!load_object (thawer, art->item, 0)) 1403 if (!load_object (thawer, art->item, 0))
1402 LOG (llevError, "Init_Artifacts: Could not load object.\n"); 1404 LOG (llevError, "Init_Artifacts: Could not load object.\n");
1403 1405
1404 art->item->name = strchr (cp, ' ') + 1; 1406 art->item->name = strchr (cp, ' ') + 1;
1493 CLEAR_FLAG (op, FLAG_ANIMATE); 1495 CLEAR_FLAG (op, FLAG_ANIMATE);
1494 /* so artifacts will join */ 1496 /* so artifacts will join */
1495 if (!QUERY_FLAG (op, FLAG_ALIVE)) 1497 if (!QUERY_FLAG (op, FLAG_ALIVE))
1496 op->speed = 0.0; 1498 op->speed = 0.0;
1497 1499
1498 update_ob_speed (op); 1500 op->set_speed (op->speed);
1499 } 1501 }
1500 1502
1501 if (change->nrof) 1503 if (change->nrof)
1502 op->nrof = RANDOM () % ((int) change->nrof) + 1; 1504 op->nrof = RANDOM () % ((int) change->nrof) + 1;
1503 1505
1515 { 1517 {
1516 object *tmp_obj; 1518 object *tmp_obj;
1517 1519
1518 /* Remove any spells this object currently has in it */ 1520 /* Remove any spells this object currently has in it */
1519 while (op->inv) 1521 while (op->inv)
1520 { 1522 op->inv->destroy ();
1521 tmp_obj = op->inv;
1522 remove_ob (tmp_obj);
1523 free_object (tmp_obj);
1524 }
1525 1523
1526 tmp_obj = arch_to_object (change->other_arch); 1524 tmp_obj = arch_to_object (change->other_arch);
1527 insert_ob_in_ob (tmp_obj, op); 1525 insert_ob_in_ob (tmp_obj, op);
1528 } 1526 }
1529 /* No harm setting this for potions/horns */ 1527 /* No harm setting this for potions/horns */
1566 op->gen_sp_armour = (op->gen_sp_armour * (change->gen_sp_armour)) / 100; 1564 op->gen_sp_armour = (op->gen_sp_armour * (change->gen_sp_armour)) / 100;
1567 1565
1568 op->item_power = change->item_power; 1566 op->item_power = change->item_power;
1569 1567
1570 for (i = 0; i < NROFATTACKS; i++) 1568 for (i = 0; i < NROFATTACKS; i++)
1571 {
1572 if (change->resist[i]) 1569 if (change->resist[i])
1573 {
1574 op->resist[i] += change->resist[i]; 1570 op->resist[i] += change->resist[i];
1575 }
1576 }
1577 1571
1578 if (change->stats.dam) 1572 if (change->stats.dam)
1579 { 1573 {
1580 if (change->stats.dam < 0) 1574 if (change->stats.dam < 0)
1581 op->stats.dam = (-change->stats.dam); 1575 op->stats.dam = (-change->stats.dam);
1812/* special_potion() - so that old potion code is still done right. */ 1806/* special_potion() - so that old potion code is still done right. */
1813 1807
1814int 1808int
1815special_potion (object *op) 1809special_potion (object *op)
1816{ 1810{
1817
1818 int i;
1819
1820 if (op->attacktype) 1811 if (op->attacktype)
1821 return 1; 1812 return 1;
1822 1813
1823 if (op->stats.Str || op->stats.Dex || op->stats.Con || op->stats.Pow || op->stats.Wis || op->stats.Int || op->stats.Cha) 1814 if (op->stats.Str || op->stats.Dex || op->stats.Con || op->stats.Pow || op->stats.Wis || op->stats.Int || op->stats.Cha)
1824 return 1; 1815 return 1;
1825 1816
1826 for (i = 0; i < NROFATTACKS; i++) 1817 for (int i = 0; i < NROFATTACKS; i++)
1827 if (op->resist[i]) 1818 if (op->resist[i])
1828 return 1; 1819 return 1;
1829 1820
1830 return 0; 1821 return 0;
1831} 1822}
1859 free_artifact (at->next); 1850 free_artifact (at->next);
1860 1851
1861 if (at->allowed) 1852 if (at->allowed)
1862 free_charlinks (at->allowed); 1853 free_charlinks (at->allowed);
1863 1854
1864 at->item->free (1); 1855 at->item->destroy (1);
1865 1856
1866 delete at; 1857 delete at;
1867} 1858}
1868 1859
1869void 1860void
1870free_artifactlist (artifactlist * al) 1861free_artifactlist (artifactlist * al)
1871{ 1862{
1872 artifactlist *nextal; 1863 artifactlist *nextal;
1873 1864
1874 for (al = first_artifactlist; al != NULL; al = nextal) 1865 for (al = first_artifactlist; al; al = nextal)
1875 { 1866 {
1876 nextal = al->next; 1867 nextal = al->next;
1877 1868
1878 if (al->items) 1869 if (al->items)
1879 free_artifact (al->items); 1870 free_artifact (al->items);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines