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.24 by root, Tue Dec 12 21:39:56 2006 UTC

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 object *ob = get_object (), *tmp; 455 object *ob = object::create (), *tmp;
456 456
457 create_treasure (t, ob, 0, difficulty, 0); 457 create_treasure (t, ob, 0, difficulty, 0);
458 458
459 /* Don't want to free the object we are about to return */ 459 /* Don't want to free the object we are about to return */
460 tmp = ob->inv; 460 tmp = ob->inv;
462 tmp->remove (); 462 tmp->remove ();
463 463
464 if (ob->inv) 464 if (ob->inv)
465 LOG (llevError, "In generate treasure, created multiple objects.\n"); 465 LOG (llevError, "In generate treasure, created multiple objects.\n");
466 466
467 ob->destroy (0); 467 ob->destroy ();
468 return tmp; 468 return tmp;
469} 469}
470 470
471/* 471/*
472 * This is a new way of calculating the chance for an item to have 472 * This is a new way of calculating the chance for an item to have
999 op->value *= 5; /* Since it's not just decoration */ 999 op->value *= 5; /* Since it's not just decoration */
1000 1000
1001 case RING: 1001 case RING:
1002 if (op->arch == NULL) 1002 if (op->arch == NULL)
1003 { 1003 {
1004 op->remove ();
1005 op->destroy (0); 1004 op->destroy ();
1006 op = NULL; 1005 op = 0;
1007 break; 1006 break;
1008 } 1007 }
1009 1008
1010 if (op->arch != ring_arch && op->arch != amulet_arch) /* It's a special artifact! */ 1009 if (op->arch != ring_arch && op->arch != amulet_arch) /* It's a special artifact! */
1011 break; 1010 break;
1390 art->chance = (uint16) value; 1389 art->chance = (uint16) value;
1391 else if (sscanf (cp, "difficulty %d", &value)) 1390 else if (sscanf (cp, "difficulty %d", &value))
1392 art->difficulty = (uint8) value; 1391 art->difficulty = (uint8) value;
1393 else if (!strncmp (cp, "Object", 6)) 1392 else if (!strncmp (cp, "Object", 6))
1394 { 1393 {
1395 art->item = get_object (); 1394 art->item = object::create ();
1396 1395
1397 if (!load_object (thawer, art->item, 0)) 1396 if (!load_object (thawer, art->item, 0))
1398 LOG (llevError, "Init_Artifacts: Could not load object.\n"); 1397 LOG (llevError, "Init_Artifacts: Could not load object.\n");
1399 1398
1400 art->item->name = strchr (cp, ' ') + 1; 1399 art->item->name = strchr (cp, ' ') + 1;
1511 { 1510 {
1512 object *tmp_obj; 1511 object *tmp_obj;
1513 1512
1514 /* Remove any spells this object currently has in it */ 1513 /* Remove any spells this object currently has in it */
1515 while (op->inv) 1514 while (op->inv)
1516 {
1517 tmp_obj = op->inv;
1518 tmp_obj->remove ();
1519 tmp_obj->destroy (0); 1515 op->inv->destroy ();
1520 }
1521 1516
1522 tmp_obj = arch_to_object (change->other_arch); 1517 tmp_obj = arch_to_object (change->other_arch);
1523 insert_ob_in_ob (tmp_obj, op); 1518 insert_ob_in_ob (tmp_obj, op);
1524 } 1519 }
1525 /* No harm setting this for potions/horns */ 1520 /* No harm setting this for potions/horns */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines