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.19 by root, Thu Sep 14 22:34:00 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;
461 if (tmp != NULL) 461 if (tmp != NULL)
462 remove_ob (tmp); 462 tmp->remove ();
463
463 if (ob->inv) 464 if (ob->inv)
464 {
465 LOG (llevError, "In generate treasure, created multiple objects.\n"); 465 LOG (llevError, "In generate treasure, created multiple objects.\n");
466 } 466
467 free_object (ob); 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
849 } 849 }
850 850
851 if (difficulty < 1) 851 if (difficulty < 1)
852 difficulty = 1; 852 difficulty = 1;
853 853
854 if (INVOKE_OBJECT (ADD_BONUS, op,
855 ARG_OBJECT (creator != op ? creator : 0),
856 ARG_INT (difficulty), ARG_INT (max_magic),
857 ARG_INT (flags)))
858 return;
859
854 if (!(flags & GT_MINIMAL)) 860 if (!(flags & GT_MINIMAL))
855 { 861 {
856 if (op->arch == crown_arch) 862 if (op->arch == crown_arch)
857 { 863 {
858 set_magic (difficulty, op, max_magic, flags); 864 set_magic (difficulty, op, max_magic, flags);
993 op->value *= 5; /* Since it's not just decoration */ 999 op->value *= 5; /* Since it's not just decoration */
994 1000
995 case RING: 1001 case RING:
996 if (op->arch == NULL) 1002 if (op->arch == NULL)
997 { 1003 {
998 remove_ob (op); 1004 op->destroy ();
999 free_object (op);
1000 op = NULL; 1005 op = 0;
1001 break; 1006 break;
1002 } 1007 }
1003 1008
1004 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! */
1005 break; 1010 break;
1384 art->chance = (uint16) value; 1389 art->chance = (uint16) value;
1385 else if (sscanf (cp, "difficulty %d", &value)) 1390 else if (sscanf (cp, "difficulty %d", &value))
1386 art->difficulty = (uint8) value; 1391 art->difficulty = (uint8) value;
1387 else if (!strncmp (cp, "Object", 6)) 1392 else if (!strncmp (cp, "Object", 6))
1388 { 1393 {
1389 art->item = get_object (); 1394 art->item = object::create ();
1390 1395
1391 if (!load_object (thawer, art->item, 0)) 1396 if (!load_object (thawer, art->item, 0))
1392 LOG (llevError, "Init_Artifacts: Could not load object.\n"); 1397 LOG (llevError, "Init_Artifacts: Could not load object.\n");
1393 1398
1394 art->item->name = strchr (cp, ' ') + 1; 1399 art->item->name = strchr (cp, ' ') + 1;
1505 { 1510 {
1506 object *tmp_obj; 1511 object *tmp_obj;
1507 1512
1508 /* Remove any spells this object currently has in it */ 1513 /* Remove any spells this object currently has in it */
1509 while (op->inv) 1514 while (op->inv)
1510 { 1515 op->inv->destroy ();
1511 tmp_obj = op->inv;
1512 remove_ob (tmp_obj);
1513 free_object (tmp_obj);
1514 }
1515 1516
1516 tmp_obj = arch_to_object (change->other_arch); 1517 tmp_obj = arch_to_object (change->other_arch);
1517 insert_ob_in_ob (tmp_obj, op); 1518 insert_ob_in_ob (tmp_obj, op);
1518 } 1519 }
1519 /* No harm setting this for potions/horns */ 1520 /* No harm setting this for potions/horns */
1556 op->gen_sp_armour = (op->gen_sp_armour * (change->gen_sp_armour)) / 100; 1557 op->gen_sp_armour = (op->gen_sp_armour * (change->gen_sp_armour)) / 100;
1557 1558
1558 op->item_power = change->item_power; 1559 op->item_power = change->item_power;
1559 1560
1560 for (i = 0; i < NROFATTACKS; i++) 1561 for (i = 0; i < NROFATTACKS; i++)
1561 {
1562 if (change->resist[i]) 1562 if (change->resist[i])
1563 {
1564 op->resist[i] += change->resist[i]; 1563 op->resist[i] += change->resist[i];
1565 }
1566 }
1567 1564
1568 if (change->stats.dam) 1565 if (change->stats.dam)
1569 { 1566 {
1570 if (change->stats.dam < 0) 1567 if (change->stats.dam < 0)
1571 op->stats.dam = (-change->stats.dam); 1568 op->stats.dam = (-change->stats.dam);
1849 free_artifact (at->next); 1846 free_artifact (at->next);
1850 1847
1851 if (at->allowed) 1848 if (at->allowed)
1852 free_charlinks (at->allowed); 1849 free_charlinks (at->allowed);
1853 1850
1854 at->item->free (1); 1851 at->item->destroy (1);
1855 1852
1856 delete at; 1853 delete at;
1857} 1854}
1858 1855
1859void 1856void
1860free_artifactlist (artifactlist * al) 1857free_artifactlist (artifactlist * al)
1861{ 1858{
1862 artifactlist *nextal; 1859 artifactlist *nextal;
1863 1860
1864 for (al = first_artifactlist; al != NULL; al = nextal) 1861 for (al = first_artifactlist; al; al = nextal)
1865 { 1862 {
1866 nextal = al->next; 1863 nextal = al->next;
1867 1864
1868 if (al->items) 1865 if (al->items)
1869 free_artifact (al->items); 1866 free_artifact (al->items);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines