I'm stumped on this one

From: Chuck Reed (master@i-55.com)
Date: 02/17/99


Hi.  I've had the problem of containers turning up with negative weight all
over my mud.  I've ptested enough to find out that when a player dies,
their containers go to their corpse and have the exact weight the object's
prototype has instead of the weight + what's inside of it.  For instance,
let's say they are carrying (or holding, it happens on both) a box that has
an empty weight of 10.  Now, we put 200 scrolls in it giving it a weight of
210 (scrolls are 1 each).  The character dies, their eq is transfered to
their corpse, but the box with 200 scrolls in it now has a weight of 10.
Thus, we remove all the scrolls and the box weighs -190.  I don't think the
code that handles object transfer has been altered, but here it is just in
case, any help would be GREATLY appreciated.

void make_corpse(struct char_data * ch)
{
  struct obj_data *corpse, *o;
  struct obj_data *money;
  int i;
  int mobhit = 0;
  extern int max_npc_corpse_time, max_pc_corpse_time;

  struct obj_data *create_money(int amount);

  corpse = create_obj();

  mobhit = GET_LEVEL(ch);

  corpse->maxhitobj = mobhit;
  corpse->item_number = NOTHING;
  corpse->in_room = NOWHERE;
  corpse->name = str_dup("corpse");

  sprintf(buf2, "The corpse of %s is lying here.", GET_NAME(ch));
  corpse->description = str_dup(buf2);

  sprintf(buf2, "the corpse of %s", GET_NAME(ch));
  corpse->short_description = str_dup(buf2);

  GET_OBJ_TYPE(corpse) = ITEM_CONTAINER;
  GET_OBJ_WEAR(corpse) = ITEM_WEAR_TAKE;
  GET_OBJ_EXTRA(corpse) = ITEM_NODONATE;
  GET_OBJ_EXTRA(corpse) = ITEM_NOAUCT;
  GET_OBJ_VAL(corpse, 0) = 0;   /* You can't store stuff in a corpse */
  GET_OBJ_VAL(corpse, 3) = 1;   /* corpse identifier */
  GET_OBJ_WEIGHT(corpse) = GET_WEIGHT(ch) + IS_CARRYING_W(ch);
  GET_OBJ_RENT(corpse) = 100000;

 if (IS_NPC(ch))
    GET_OBJ_TIMER(corpse) = max_npc_corpse_time;
  else
    GET_OBJ_TIMER(corpse) = max_pc_corpse_time;

  if (IS_NPC(ch))
    GET_OBJ_OWNER(corpse) = -1;
  else if (PLR_FLAGGED(ch, PLR_OUTLAW))
    GET_OBJ_OWNER(corpse) = 0;
  else
    GET_OBJ_OWNER(corpse) = GET_IDNUM(ch);

  /* transfer character's inventory to the corpse */
  corpse->contains = ch->carrying;
  for (o = corpse->contains; o != NULL; o = o->next_content)
    o->in_obj = corpse;
  object_list_new_owner(corpse, NULL);

  /* transfer character's equipment to the corpse */
 for (i = 0; i < NUM_WEARS; i++)
    if (GET_EQ(ch, i))
      obj_to_obj(unequip_char(ch, i), corpse);

  /* transfer gold */
  if (GET_GOLD(ch) > 0) {
    /* following 'if' clause added to fix gold duplication loophole */
    if (IS_NPC(ch) || (!IS_NPC(ch) && ch->desc)) {
      money = create_money(GET_GOLD(ch));
      obj_to_obj(money, corpse);
    }
    GET_GOLD(ch) = 0;
  }
  ch->carrying = NULL;
  IS_CARRYING_N(ch) = 0;
  IS_CARRYING_W(ch) = 0;
  obj_to_room(corpse, ch->in_room);

  if (!IS_NPC(ch) && !ROOM_FLAGGED(ch->in_room, ROOM_ARENA) &&
!PLR_FLAGGED(ch,$
    REMOVE_BIT(PLR_FLAGS(ch), PLR_KILLER | PLR_THIEF | PLR_OUTLAW);
}

-------
"Remember, you are unique and special . . . . just like everyone else!"
                                        -Bumpersticker

"Friends help you move.  Real friends help you move bodies."
                                        -Bumpersticker

"You believe in God, she believes in Allah, they believe in Jesus . . . .
can I just believe in He-Man?"
                                        -Chuck Reed
-------


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST