Re[2]: suggestion for the next patch level

From: Angus Mezick (angus@EDGIL.CCMAIL.COMPUSERVE.COM)
Date: 10/15/97


     db.c:setup_dir():

        if (!get_line(fl, line))
           {
           fprintf(stderr, "Format error, %s\n", buf2);
           exit(1);
           }
        if (sscanf(line, " %d %d %d ", t, t + 1, t + 2) != 3)
           {
           fprintf(stderr, "Format error, %s\n", buf2);
           exit(1);
           }
        if (t[0] & EX_PICKPROOF)
           SET_BIT(t[0],EX_ISDOOR);
        if(t[0]&EX_LOCKED)
           REMOVE_BIT(t[0],EX_LOCKED);
        if(t[0]&EX_CLOSED)
           REMOVE_BIT(t[0],EX_CLOSED);

     structs.h:
     #define EX_ISDOOR           (1 << 0)   /* Exit is a door            */
     #define EX_PICKPROOF        (1 << 1)   /* Lock can't be picked      */
     #define EX_CLOSED           (1 << 2)   /* The door is closed        */
     #define EX_LOCKED           (1 << 3)   /* The door is locked        */
     #define EX_SECRET           (1 << 4)   /* can't be seen at all      */


     redit.c:redit_save_to_disk {oasis olc}
                   /*. Figure out door flag .*/
                    temp_door_flag=room->dir_option[counter2]->exit_info;

                    if(temp_door_flag & EX_PICKPROOF)
                       SET_BIT(temp_door_flag,EX_ISDOOR);
                    if(temp_door_flag&EX_CLOSED)
                       REMOVE_BIT(temp_door_flag,EX_CLOSED);
                    if(temp_door_flag&EX_LOCKED)
                       REMOVE_BIT(temp_door_flag,EX_LOCKED);


     redit.c:void redit_disp_exit_menu(struct descriptor_data * d)
     {
        char *buf=get_buffer(MAX_STRING_LENGTH);
        char *buf2=get_buffer(MAX_STRING_LENGTH);
       /* if exit doesn't exist, alloc/create it */
        if(!OLC_EXIT(d))
           CREATE(OLC_EXIT(d), struct room_direction_data, 1);

       /* weird door handling! */
        if (IS_SET(OLC_EXIT(d)->exit_info, EX_ISDOOR))
           {
           if (IS_SET(OLC_EXIT(d)->exit_info, EX_PICKPROOF))
              strcpy(buf2, "Pickproof");
           else
              strcpy(buf2, "Is a door");
           }
        else
           strcpy(buf2, "No door");

        if (IS_SET(OLC_EXIT(d)->exit_info, EX_SECRET))
           strcat(buf2," (secret)");

     redit.c:redit_parse():
            case REDIT_EXIT_DOORFLAGS:
               vnumber = atoi(arg);
               if ((vnumber < 0) || (vnumber > 3))
                  {
                  send_to_char("That's not a valid choice!\r\n",
     d->character);
                  redit_disp_exit_flag_menu(d);
                  }
               else
                  {
                 /* doors are a bit idiotic, don't you think? :) */
                  if (vnumber == 0)
                     OLC_EXIT(d)->exit_info = 0;
                  else if (vnumber == 1)
                     OLC_EXIT(d)->exit_info |= EX_ISDOOR;
                  else if (vnumber == 2)
                     OLC_EXIT(d)->exit_info |= EX_ISDOOR | EX_PICKPROOF;
                  else if(vnumber==3)
                     OLC_EXIT(d)->exit_info |= EX_SECRET;
                 /* jump out to menu */
                  redit_disp_exit_menu(d);
                  }
               release_buffer(buf);
               return;

     these changes should do it.  I am leaving it up to you to figure out
     what got changed where, shouldn't be too hard. you will also need to
     add the code for EX_SECRET to autoexit, do_simple_move(?), and do_look
     so that the exit doesn't actually show up. (i would also suggest
     showing non-secret door in autoexit as [east] just so the secret ones
     slip by more easily)
     --Angus



______________________________ Reply Separator _________________________________
Subject: Re:  suggestion for the next patch level
Author:  INTERNET:CIRCLE@post.queensu.ca at CSERVE
Date:    10/14/97 5:00 PM

>change the way exit flags work from being an int to a bit field.  If you
>move EX_PICKPROOF to (1<<1) you will not have to change the world format
>at all. (pickproof will have to be coded so that it automatically inserts
>EX_ISADOOR for sanity's sake)  I ran into this when adding a secret flag
>to the doors and was going to add a magic wall types that I wanted to have
>save to the doors.  right now doors just work in a freaky way.

Already did that in my MUD, but I believe that is there for backwards Diku
compatibility.  I would like to change it, if you can elaborate more on the
changes and they work fine with old and new formats, I'll make a change up
for it.

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | 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/08/00 PST