Re: Rlink updated? (code)

From: Mechanical Animal (acydtryp@mail.com)
Date: 11/11/00


This is my rlink that I umm.. edited.

Checks for zone rights, and adds it to the save list.
I'm l33t ;)

ACMD(do_rlink)
{
/* Only works if you have Oasis OLC */
extern int add_to_save_list(zone_vnum, int type);

  char buf2[10];
  char buf3[10];
  char buf[80];
  int iroom = 0, rroom = 0;
  int dir = 0;
  struct room_data *room;

  two_arguments(argument, buf2, buf3);
  /* buf2 is the direction, buf3 is the room */
CREATE(room, struct room_data, 1);
iroom = atoi(buf3);
rroom = real_room(iroom);
*room = world[rroom];

 if (!*buf2) {
    send_to_char("Format: rlink <dir> <room number>\r\n", ch);
    return;
 }
 else if (!*buf3) {
    send_to_char("Format: rlink <dir> <room number>\r\n", ch);
    return;
 }
 if (rroom <= 0) {
    sprintf(buf, "There is no room with the number %d", iroom);
    send_to_char(buf, ch);
    return;
 }
/* Main stuff */

 if (zone_table[room->zone].number != GET_OLC_ZONE(ch)) {
   send_to_char("You do not have permission to rlink to that zone.\r\n", ch);
   return;
 }

  switch (*buf2) {
    case 'n':
    case 'N':
      dir = NORTH;
      break;
    case 'e':
    case 'E':
      dir = EAST;
      break;
    case 's':
    case 'S':
      dir = SOUTH;
      break;
    case 'w':
    case 'W':
      dir = WEST;
      break;
    case 'u':
    case 'U':
      dir = UP;
      break;
    case 'd':
    case 'D':
      dir = DOWN;
      break;
  }

CREATE(world[rroom].dir_option[rev_dir[dir]], struct room_direction_data,1);
  world[rroom].dir_option[rev_dir[dir]]->general_description = NULL;
  world[rroom].dir_option[rev_dir[dir]]->keyword = NULL;
  world[rroom].dir_option[rev_dir[dir]]->to_room = ch->in_room;

CREATE(world[ch->in_room].dir_option[dir], struct room_direction_data,1);
  world[ch->in_room].dir_option[dir]->general_description = NULL;
  world[ch->in_room].dir_option[dir]->keyword = NULL;
  world[ch->in_room].dir_option[dir]->to_room = rroom;

/* Only works if you have Oasis OLC */
  add_to_save_list((iroom/100), SL_WLD);
  sprintf(buf, "You make an exit %s to room %d.\r\n", buf2, iroom);
  send_to_char(buf, ch);
}

Hope this wraps.
Peace.
TrYp'00

Regards,
  The Mechanical Animal
<acydtryp@mail.com>

______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup


     +------------------------------------------------------------+
     | 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 : 04/11/01 PDT