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.23 by root, Tue Dec 12 20:53:02 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;
462 tmp->remove (); 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 ob->destroy (0); 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
999 op->value *= 5; /* Since it's not just decoration */ 1001 op->value *= 5; /* Since it's not just decoration */
1000 1002
1001 case RING: 1003 case RING:
1002 if (op->arch == NULL) 1004 if (op->arch == NULL)
1003 { 1005 {
1004 op->remove ();
1005 op->destroy (0); 1006 op->destroy ();
1006 op = NULL; 1007 op = 0;
1007 break; 1008 break;
1008 } 1009 }
1009 1010
1010 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! */
1011 break; 1012 break;
1390 art->chance = (uint16) value; 1391 art->chance = (uint16) value;
1391 else if (sscanf (cp, "difficulty %d", &value)) 1392 else if (sscanf (cp, "difficulty %d", &value))
1392 art->difficulty = (uint8) value; 1393 art->difficulty = (uint8) value;
1393 else if (!strncmp (cp, "Object", 6)) 1394 else if (!strncmp (cp, "Object", 6))
1394 { 1395 {
1395 art->item = get_object (); 1396 art->item = object::create ();
1396 1397
1397 if (!load_object (thawer, art->item, 0)) 1398 if (!load_object (thawer, art->item, 0))
1398 LOG (llevError, "Init_Artifacts: Could not load object.\n"); 1399 LOG (llevError, "Init_Artifacts: Could not load object.\n");
1399 1400
1400 art->item->name = strchr (cp, ' ') + 1; 1401 art->item->name = strchr (cp, ' ') + 1;
1511 { 1512 {
1512 object *tmp_obj; 1513 object *tmp_obj;
1513 1514
1514 /* Remove any spells this object currently has in it */ 1515 /* Remove any spells this object currently has in it */
1515 while (op->inv) 1516 while (op->inv)
1516 {
1517 tmp_obj = op->inv;
1518 tmp_obj->remove ();
1519 tmp_obj->destroy (0); 1517 op->inv->destroy ();
1520 }
1521 1518
1522 tmp_obj = arch_to_object (change->other_arch); 1519 tmp_obj = arch_to_object (change->other_arch);
1523 insert_ob_in_ob (tmp_obj, op); 1520 insert_ob_in_ob (tmp_obj, op);
1524 } 1521 }
1525 /* 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