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.77 by root, Mon May 5 22:18:00 2008 UTC vs.
Revision 1.81 by root, Mon Sep 29 10:31:32 2008 UTC

45typedef std::tr1::unordered_map< 45typedef std::tr1::unordered_map<
46 const char *, 46 const char *,
47 treasurelist *, 47 treasurelist *,
48 str_hash, 48 str_hash,
49 str_equal, 49 str_equal,
50 slice_allocator< std::pair<const char *const, treasurelist *> >, 50 slice_allocator< std::pair<const char *const, treasurelist *> >
51 true
52> tl_map_t; 51> tl_map_t;
53 52
54static tl_map_t tl_map; 53static tl_map_t tl_map;
55 54
56/* 55/*
249 * by another object. 248 * by another object.
250 */ 249 */
251 //TODO: flag such as objects... as such (no drop, anybody?) 250 //TODO: flag such as objects... as such (no drop, anybody?)
252 if (op->type == SPELL) 251 if (op->type == SPELL)
253 { 252 {
254 op->destroy (); 253 op->destroy (true);
255 return; 254 return;
256 } 255 }
257 256
258 op->expand_tail (); 257 op->expand_tail ();
259 258
260 if (!creator->is_on_map () || op->blocked (creator->map, creator->x, creator->y)) 259 if (!creator->is_on_map () || op->blocked (creator->map, creator->x, creator->y))
261 op->destroy (); 260 op->destroy (true);
262 else 261 else
263 { 262 {
264 SET_FLAG (op, FLAG_OBJ_ORIGINAL); 263 SET_FLAG (op, FLAG_OBJ_ORIGINAL);
265 op->insert_at (creator, creator, INS_NO_MERGE | INS_NO_WALK_ON); 264 op->insert_at (creator, creator, INS_NO_MERGE | INS_NO_WALK_ON);
266 } 265 }
441 tmp->remove (); 440 tmp->remove ();
442 441
443 if (ob->inv) 442 if (ob->inv)
444 LOG (llevError, "In generate treasure, created multiple objects.\n"); 443 LOG (llevError, "In generate treasure, created multiple objects.\n");
445 444
446 ob->destroy (); 445 ob->destroy (true);
446
447 return tmp; 447 return tmp;
448} 448}
449 449
450/* 450/*
451 * This is a new way of calculating the chance for an item to have 451 * This is a new way of calculating the chance for an item to have
578 if (op->type == ARMOUR) 578 if (op->type == ARMOUR)
579 ARMOUR_SPEED (op) = (ARMOUR_SPEED (op->arch) * (100 + magic * 10)) / 100; 579 ARMOUR_SPEED (op) = (ARMOUR_SPEED (op->arch) * (100 + magic * 10)) / 100;
580 580
581 if (magic < 0 && !(rndm (3))) /* You can't just check the weight always */ 581 if (magic < 0 && !(rndm (3))) /* You can't just check the weight always */
582 magic = (-magic); 582 magic = (-magic);
583
583 op->weight = (op->arch->weight * (100 - magic * 10)) / 100; 584 op->weight = (op->arch->weight * (100 - magic * 10)) / 100;
584 } 585 }
585 else 586 else
586 { 587 {
587 if (op->type == ARMOUR) 588 if (op->type == ARMOUR)
588 ARMOUR_SPEED (op) = (ARMOUR_SPEED (op) * (100 + magic * 10)) / 100; 589 ARMOUR_SPEED (op) = (ARMOUR_SPEED (op) * (100 + magic * 10)) / 100;
590
589 if (magic < 0 && !(rndm (3))) /* You can't just check the weight always */ 591 if (magic < 0 && !(rndm (3))) /* You can't just check the weight always */
590 magic = (-magic); 592 magic = (-magic);
593
591 op->weight = (op->weight * (100 - magic * 10)) / 100; 594 op->weight = (op->weight * (100 - magic * 10)) / 100;
592 } 595 }
593} 596}
594 597
595/* 598/*
963 case AMULET: 966 case AMULET:
964 if (IS_ARCH (op->arch, amulet)) 967 if (IS_ARCH (op->arch, amulet))
965 op->value *= 5; /* Since it's not just decoration */ 968 op->value *= 5; /* Since it's not just decoration */
966 969
967 case RING: 970 case RING:
968 if (!op->arch) // wtf? schmorp
969 {
970 op->destroy ();
971 op = 0;
972 break;
973 }
974
975 if (!IS_ARCH (op->arch, ring) && !IS_ARCH (op->arch, amulet)) /* It's a special artifact! */ 971 if (!IS_ARCH (op->arch, ring) && !IS_ARCH (op->arch, amulet)) /* It's a special artifact! */
976 break; 972 break;
977 973
978 if (!(flags & GT_ONLY_GOOD) && !(rndm (3))) 974 if (!(flags & GT_ONLY_GOOD) && !(rndm (3)))
979 SET_FLAG (op, FLAG_CURSED); 975 SET_FLAG (op, FLAG_CURSED);
1351 * to cast. So convert that to into a spell and put it into 1347 * to cast. So convert that to into a spell and put it into
1352 * this object. 1348 * this object.
1353 */ 1349 */
1354 if (op->type == HORN || op->type == POTION) 1350 if (op->type == HORN || op->type == POTION)
1355 { 1351 {
1356 object *tmp_obj;
1357
1358 /* Remove any spells this object currently has in it */ 1352 /* Remove any spells this object currently has in it */
1359 while (op->inv)
1360 op->inv->destroy (); 1353 op->destroy_inv (false);
1361 1354
1362 tmp_obj = arch_to_object (change->other_arch); 1355 object *tmp = arch_to_object (change->other_arch);
1363 insert_ob_in_ob (tmp_obj, op); 1356 insert_ob_in_ob (tmp, op);
1364 } 1357 }
1365 /* No harm setting this for potions/horns */ 1358 /* No harm setting this for potions/horns */
1366 op->other_arch = change->other_arch; 1359 op->other_arch = change->other_arch;
1367 } 1360 }
1368 1361
1684free_artifact (artifact *at) 1677free_artifact (artifact *at)
1685{ 1678{
1686 if (at->next) free_artifact (at->next); 1679 if (at->next) free_artifact (at->next);
1687 if (at->allowed) free_charlinks (at->allowed); 1680 if (at->allowed) free_charlinks (at->allowed);
1688 1681
1689 at->item->destroy (1); 1682 at->item->destroy (true);
1690 1683
1691 sfree (at); 1684 sfree (at);
1692} 1685}
1693 1686
1694void 1687void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines