[PROBLEM] do_wear (or similar)

From: Julian Buckley (buckley@PC.ELEC.UQ.EDU.AU)
Date: 11/05/98


Hi list...

I encountered a problem today in the fact that, when wearing an item, the
following occurs:

***SNIP***
  1900H 500M 250V > wield sword
  You wield a Slaying Sword.

  1900H 500M 250V > i
  You are carrying:
  a Slaying Sword (glowing)  (humming)

  1900H 500M 250V > eq
  You are using:
  <wielded>            a Slaying Sword (glowing)  (humming)
  ***END SNIP*

  Note that, after wielding the sword, the sword is on the eq list, but
still
  in the inventory list.  If I then "remove sword", the mud lags out until
it
  gets killed.  However, if I type "save", the following error message
  appears in the syslogs...

  Fri Nov 06 08:53:46 :: SYSERR: EQUIP: Obj is carried_by when equip.

  The only things I've added recently were two new wear positions (ear,
  ankle) and attempted to let "wear all" include wieldables.  I have since
  removed these things, however the error still exists.

  Can anyone direct me to where I should be looking, or has anyone had this
  problem?  All help appreciated.

  I've got the patch "autoeq.bpl11" installed, but that didnt seem to make
a
  difference.

  All associated code is following:


  int find_eq_pos(struct char_data * ch, struct obj_data * obj, char *arg)
  {
    int where = -1;

    static char *keywords[] = {
      << INSERT STOCK CM BPL12 KEYWORDS HERE >>
      "face",
  /*    "ear",
      "!RESERVED!",
      "ankle", */
      "\n"
    };
    if (!arg || !*arg) {
      << INSERT STOCK CM BPL12 WEAR DEFINES HERE >>
      if (CAN_WEAR(obj, ITEM_WEAR_FACE))        where = WEAR_FACE;
  /*    if (CAN_WEAR(obj, ITEM_WEAR_EAR))         where = WEAR_EAR_R;
      if (CAN_WEAR(obj, ITEM_WEAR_ANKLE))       where = WEAR_ANKLE; */
    } else {
      if ((where = search_block(arg, keywords, FALSE)) < 0) {
        sprintf(buf, "'%s'?  What part of your body is THAT?\r\n", arg);
        send_to_char(buf, ch);
      }
    }
    return where;
  }

  ACMD(do_wear)
  {
    char arg1[MAX_INPUT_LENGTH];
    char arg2[MAX_INPUT_LENGTH];
    struct obj_data *obj, *next_obj;
    int where, dotmode, items_worn = 0;

    two_arguments(argument, arg1, arg2);

    if (!*arg1) {
      send_to_char("Wear what?\r\n", ch);
      return;
    }
    dotmode = find_all_dots(arg1);

    if (*arg2 && (dotmode != FIND_INDIV)) {
      send_to_char("You can't specify the same body location for more than
one item!\r\n", ch);
      return;
    }
    if (dotmode == FIND_ALL) {
      for (obj = ch->carrying; obj; obj = next_obj) {
        next_obj = obj->next_content;
        if (CAN_SEE_OBJ(ch, obj) && (where = find_eq_pos(ch, obj, 0)) >= 0)
 {
          items_worn++;
          perform_wear(ch, obj, where);
        }
      }
      if (!items_worn)
        send_to_char("You don't seem to have anything wearable.\r\n", ch);
    } else if (dotmode == FIND_ALLDOT) {
      if (!*arg1) {
        send_to_char("Wear all of what?\r\n", ch);
        return;
      }
      if (!(obj = get_obj_in_list_vis(ch, arg1, ch->carrying))) {
        sprintf(buf, "You don't seem to have any %ss.\r\n", arg1);
        send_to_char(buf, ch);
      } else
        while (obj) {
          next_obj = get_obj_in_list_vis(ch, arg1, obj->next_content);
          if ((where = find_eq_pos(ch, obj, 0)) >= 0)
            perform_wear(ch, obj, where);
          else
            act("You can't wear $p.", FALSE, ch, obj, 0, TO_CHAR);
          obj = next_obj;
        }
    } else {
      if (!(obj = get_obj_in_list_vis(ch, arg1, ch->carrying))) {
        sprintf(buf, "You don't seem to have %s %s.\r\n", AN(arg1), arg1);
        send_to_char(buf, ch);
      } else if (GET_LEVEL(ch) < GET_OBJ_LEVEL(obj)) {
          send_to_char("You are not experienced enough to use that.\r\n",
ch);
        } else {
          if ((where = find_eq_pos(ch, obj, arg2)) >= 0)
            perform_wear(ch, obj, where);
          else if (!*arg2)
            act("You can't wear $p.", FALSE, ch, obj, 0, TO_CHAR);
        }
    }
  }

  ACMD(do_wield)
  {
    struct obj_data *obj;

    one_argument(argument, arg);

    if (!*arg)
      send_to_char("Wield what?\r\n", ch);
    else if (!(obj = get_obj_in_list_vis(ch, arg, ch->carrying))) {
      sprintf(buf, "You don't seem to have %s %s.\r\n", AN(arg), arg);
      send_to_char(buf, ch);
    } else {
      if (!CAN_WEAR(obj, ITEM_WEAR_WIELD))
        send_to_char("You can't wield that.\r\n", ch);
      else if (GET_OBJ_WEIGHT(obj) >
  str_app[STRENGTH_APPLY_INDEX(ch)].wield_w)
        send_to_char("It's too heavy for you to use.\r\n", ch);
      else
        perform_wear(ch, obj, WEAR_WIELD);
    }
 }


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



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