Re: [CODE] [QUESTION] Stables

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


Ok, here it comes again. The char_to_room function doesn't seem to work
properly. No mount is loaded, but the acts show to the char and to the
room. I changed the return 0's to 1's, but then my char froze as soon as I
typed something in the room.

SPECIAL(stables)
{
  struct char_data *horse;
  int 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("receive")) {
    if (GET_MOUNT(ch) == NULL) {
      send_to_char("You have no mount rented here.\r\n", ch);
      return 0;
    }
    horse = read_mobile(GET_MOUNT(ch), VIRTUAL);
    act("A stableboy arrives with your mount.", FALSE, ch, 0, 0, TO_CHAR);
    act("A stableboy arrives with $n's mount.", FALSE, ch, 0, 0, TO_ROOM);
    char_to_room(horse, ch->in_room);
    GET_MOUNT(ch) = 0;
    return 0;
  }
  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