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.21 by root, Wed Sep 27 00:36:08 2006 UTC vs.
Revision 1.25 by root, Tue Dec 12 22:37:05 2006 UTC

448 * it instead takes a treasurelist. It is really just a wrapper around 448 * it instead takes a treasurelist. It is really just a wrapper around
449 * create_treasure. We create a dummy object that the treasure gets 449 * create_treasure. We create a dummy object that the treasure gets
450 * inserted into, and then return that treausre 450 * inserted into, and then return that treausre
451 */ 451 */
452object * 452object *
453generate_treasure (treasurelist * t, int difficulty) 453generate_treasure (treasurelist *t, int difficulty)
454{ 454{
455 difficulty = clamp (difficulty, 1, settings.max_level);
456
455 object *ob = get_object (), *tmp; 457 object *ob = object::create (), *tmp;
456 458
457 create_treasure (t, ob, 0, difficulty, 0); 459 create_treasure (t, ob, 0, difficulty, 0);
458 460
459 /* Don't want to free the object we are about to return */ 461 /* Don't want to free the object we are about to return */
460 tmp = ob->inv; 462 tmp = ob->inv;
461 if (tmp != NULL) 463 if (tmp != NULL)
462 remove_ob (tmp); 464 tmp->remove ();
463 465
464 if (ob->inv) 466 if (ob->inv)
465 LOG (llevError, "In generate treasure, created multiple objects.\n"); 467 LOG (llevError, "In generate treasure, created multiple objects.\n");
466 468
467 free_object (ob); 469 ob->destroy ();
468 return tmp; 470 return tmp;
469} 471}
470 472
471/* 473/*
472 * This is a new way of calculating the chance for an item to have 474 * This is a new way of calculating the chance for an item to have
849 } 851 }
850 852
851 if (difficulty < 1) 853 if (difficulty < 1)
852 difficulty = 1; 854 difficulty = 1;
853 855
856 if (INVOKE_OBJECT (ADD_BONUS, op,
857 ARG_OBJECT (creator != op ? creator : 0),
858 ARG_INT (difficulty), ARG_INT (max_magic),
859 ARG_INT (flags)))
860 return;
861
854 if (!(flags & GT_MINIMAL)) 862 if (!(flags & GT_MINIMAL))
855 { 863 {
856 if (op->arch == crown_arch) 864 if (op->arch == crown_arch)
857 { 865 {
858 set_magic (difficulty, op, max_magic, flags); 866 set_magic (difficulty, op, max_magic, flags);
993 op->value *= 5; /* Since it's not just decoration */ 1001 op->value *= 5; /* Since it's not just decoration */
994 1002
995 case RING: 1003 case RING:
996 if (op->arch == NULL) 1004 if (op->arch == NULL)
997 { 1005 {
998 remove_ob (op); 1006 op->destroy ();
999 free_object (op);
1000 op = NULL; 1007 op = 0;
1001 break; 1008 break;
1002 } 1009 }
1003 1010
1004 if (op->arch != ring_arch && op->arch != amulet_arch) /* It's a special artifact! */ 1011 if (op->arch != ring_arch && op->arch != amulet_arch) /* It's a special artifact! */
1005 break; 1012 break;
1384 art->chance = (uint16) value; 1391 art->chance = (uint16) value;
1385 else if (sscanf (cp, "difficulty %d", &value)) 1392 else if (sscanf (cp, "difficulty %d", &value))
1386 art->difficulty = (uint8) value; 1393 art->difficulty = (uint8) value;
1387 else if (!strncmp (cp, "Object", 6)) 1394 else if (!strncmp (cp, "Object", 6))
1388 { 1395 {
1389 art->item = get_object (); 1396 art->item = object::create ();
1390 1397
1391 if (!load_object (thawer, art->item, 0)) 1398 if (!load_object (thawer, art->item, 0))
1392 LOG (llevError, "Init_Artifacts: Could not load object.\n"); 1399 LOG (llevError, "Init_Artifacts: Could not load object.\n");
1393 1400
1394 art->item->name = strchr (cp, ' ') + 1; 1401 art->item->name = strchr (cp, ' ') + 1;
1505 { 1512 {
1506 object *tmp_obj; 1513 object *tmp_obj;
1507 1514
1508 /* Remove any spells this object currently has in it */ 1515 /* Remove any spells this object currently has in it */
1509 while (op->inv) 1516 while (op->inv)
1510 { 1517 op->inv->destroy ();
1511 tmp_obj = op->inv;
1512 remove_ob (tmp_obj);
1513 free_object (tmp_obj);
1514 }
1515 1518
1516 tmp_obj = arch_to_object (change->other_arch); 1519 tmp_obj = arch_to_object (change->other_arch);
1517 insert_ob_in_ob (tmp_obj, op); 1520 insert_ob_in_ob (tmp_obj, op);
1518 } 1521 }
1519 /* No harm setting this for potions/horns */ 1522 /* No harm setting this for potions/horns */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines