Re: room clone

From: Mike Breuer (mbreuer@new.rr.com)
Date: 10/23/01


From: "nwhite" <nathanmwhite@EARTHLINK.NET>
> hey hey anyone been succesful with doing a room clone code?

I use the following code with Oasis OLC.  I stripped out everything that I
believe is specific to my MUD.  Hopefully I didn't strip out too much.  :-)
I modified redit (and others) to support this syntax:

redit <new vnum> like <existing vnum>

This function is called in place of redit_setup_new() when the above command
line is used:

void redit_clone_existing(struct descriptor_data *d, int real_num)
{
  struct room_data *room = &world[real_num];

  CREATE(OLC_ROOM(d), struct room_data, 1);

  OLC_ROOM(d)->name = str_dup(room->name);
  OLC_ROOM(d)->description = str_dup(room->description);
  OLC_ROOM(d)->number = NOWHERE;
  OLC_ROOM(d)->room_flags = room->room_flags;
  OLC_ROOM(d)->sector_type = room->sector_type;

  /*
   * Extra descriptions, if necessary.
   */
  if (room->ex_description) {
    struct extra_descr_data *tdesc, *temp, *temp2;
    CREATE(temp, struct extra_descr_data, 1);

    OLC_ROOM(d)->ex_description = temp;
    for (tdesc = room->ex_description; tdesc; tdesc = tdesc->next) {
      temp->keyword = str_dup(tdesc->keyword);
      temp->description = str_dup(tdesc->description);
      if (tdesc->next) {
        CREATE(temp2, struct extra_descr_data, 1);
        temp->next = temp2;
        temp = temp2;
      } else
        temp->next = NULL;
    }
  }

  redit_disp_menu(d);
  OLC_VAL(d) = TRUE;
}

I deliberately skip over all the exits, because 99% of the time it doesn't
make sense to clone them.

Mike

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST