Copy door info

From: JonB (Jon@THEBARRETTS.COM)
Date: 06/27/98


In response to the verify exit thread, I got an idea to help put a stop to
those exits that didn't match.  What I did was, every time someone redits
an exit, it will ask to copy the door info to the corresponding room if:
1) The corresponding room != NOWHERE
2) The exit info has EX_ISDOOR set

Then if they want to copy it, it will copy the following info the the
corresponding room:
1) door keywords
2) door flags
3) key num
4) exit general_description

I figured in _most_ cases, the door would be the same on both sides, but if
they aren't just say no to copy the info.....

The code isn't too long so I went ahead and icluded it.  Anybody is free to
use it, I just ask that you include me somewhere in the code or credits.
And I hope it proves useful. Oh, sorry bout the mailer code. :P

*** ./stk/redit.c       Sat Jun 27 06:58:58 1998
--- ./src/redit.c       Sat Jun 27 07:05:22 1998
*************** void redit_parse(struct descriptor_data
*** 1024,1030 ****
    case REDIT_EXIT_MENU:
      switch (*arg) {
      case '0':
!         break;
      case '1':
        OLC_MODE(d) = REDIT_EXIT_NUMBER;
        send_to_char("Exit to room number : ", d->character);
--- 1024,1035 ----
    case REDIT_EXIT_MENU:
      switch (*arg) {
      case '0':
!               if ((OLC_EXIT(d)->to_room != NOWHERE) && EXIT_FLAGGED(OLC_EXIT(d),
EX_ISDOOR)) {
!                       SEND_TO_Q("Would you like to copy the door info to the other
room(Y//N)? ", d);
!                       OLC_MODE(d) = REDIT_COPY_DOOR;
!                       return;
!               }
!               break;
      case '1':
        OLC_MODE(d) = REDIT_EXIT_NUMBER;
        send_to_char("Exit to room number : ", d->character);
*************** void redit_parse(struct descriptor_data
*** 1070,1075 ****
--- 1075,1117 ----
        return;
      }
      break;
+
+   case REDIT_COPY_DOOR:
+         //* Nifty little door copy to prevent one sided doors. -jB 26Jun98
+         if (!arg || !*arg) {
+                 SEND_TO_Q("Would you like to copy the door info to the other
room(Y//N)!? ", d);
+                 return;
+         }
+         switch (*arg) {
+         case 'y':
+         case 'Y':
+                 switch(OLC_VAL(d)) {
+                 case NORTH: number = SOUTH; break;
+                 case SOUTH: number = NORTH; break;
+                 case EAST:  number = WEST; break;
+                 case WEST:  number = EAST; break;
+                 case UP:    number = DOWN; break;
+                 case DOWN:  number = UP; break;
+                 }
+                 if (world[OLC_EXIT(d)->to_room].dir_option[number]->keyword)
+                         free(world[OLC_EXIT(d)->to_room].dir_option[number]->keyword);
+                 world[OLC_EXIT(d)->to_room].dir_option[number]->keyword =
str_dup(OLC_EXIT(d)->keyword);
+                 world[OLC_EXIT(d)->to_room].dir_option[number]->exit_info =
OLC_EXIT(d)->exit_info;
+                 if (OLC_EXIT(d)->general_description) {
+                         if
(world[OLC_EXIT(d)->to_room].dir_option[number]->general_description)
+                                 free
(world[OLC_EXIT(d)->to_room].dir_option[number]->general_description);
+                         world[OLC_EXIT(d)->to_room].dir_option[number]->general_description
= str_dup(OLC_EXIT(d)->general_description);
+                 }
+                 world[OLC_EXIT(d)->to_room].dir_option[number]->key = OLC_EXIT(d)->key;
+                 break;
+         case 'n':
+         case 'N':
+                 break;
+         default:
+                 SEND_TO_Q("Please enter Y or N: ", d);
+                 return;
+         }
+         break;

    case REDIT_EXIT_NUMBER:
      if ((number = atoi(arg)) != -1)*** ./stk/olc.h    Sat Jun 27 07:08:48 1998
--- ./src/olc.h Sat Jun 27 06:08:04 1998
*************** extern struct olc_save_info *olc_save_li
*** 242,247 ****
--- 242,248 ----
  #define REDIT_EXTRADESC_KEY           15
  #define REDIT_EXTRADESC_DESCRIPTION   16
  #define REDIT_GOTO_ROOM                               17
+ #define REDIT_COPY_DOOR                               18

  /*
   * Submodes of ZEDIT connectedness.


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