[CODE] [QUESTION] Stables

From: Christoffer Lundberg (avatar@ORION.BODEN.SE)
Date: 02/24/98


I have a problem with my stable spec_proc. I can manage to rent my mount,
but when I wish to retrieve it, the MUD crashes.
Can anyone look through the code I attach to this mail and help me out?

SPECIAL(stables)
{
  struct char_data *horse;
  int mount, vnum;
  one_argument(argument, arg);

  if (CMD_IS("rent")) {
    if (!(horse = get_char_room_vis(ch, arg))) {
      send_to_char("That mount isn't here.\r\n", ch);
      return 0;
    }
    if (!MOB_FLAGGED(horse, MOB_MOUNTABLE)) {
      send_to_char("They aren't a mount!\r\n", ch);
      return 0;
    }
    if (horse->carrying) {
      send_to_char("You better remove your stuff from your mount before
renting it.\r\n", ch);
      return 0;
    }
    if (GET_GOLD(ch) < (GET_LEVEL(horse) * 10)) {
      send_to_char("You are too short on funds.\r\n", ch);
      return 0;
    }
    vnum = GET_MOB_VNUM(horse);
    act("A stableboy takes care of $N.", FALSE, ch, 0, horse, TO_CHAR);
    act("A stableboy takes care of you.", FALSE, ch, 0, horse, TO_VICT);
    act("A stableboy takes care of $n's $N.", FALSE, ch, 0, horse,
TO_NOTVICT);
    GET_MOUNT(ch) = vnum;
    GET_GOLD(ch) -= (GET_LEVEL(horse) * 10);
    extract_char(horse);
    return 0;
  }
  if (CMD_IS("retrieve")) {
    if (GET_MOUNT(ch) == NULL) {
      send_to_char("You have no mount rented here.\r\n", ch);
      return 0;
    }
    horse = GET_MOUNT(ch);
    mount = read_mobile(horse, VIRTUAL);
    char_to_room(horse, ch->in_room);
    act("A stableboy arrives with your mount.", FALSE, ch, 0, horse,
TO_CHAR);
    act("A stableboy arrives with $n's mount.", FALSE, ch, 0, horse,
TO_ROOM);
    add_follower(horse, ch);
  }
  return 0;
}




/Avatar


     +------------------------------------------------------------+
     | 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