Error in Room Dig-like Command

From: Jory Graham (Treimor@aol.com)
Date: 08/18/01


I made an "outworld" of sorts for my mud using the ascii mapping system
snippet a few months ago. Since then, I made a ~2000 room map by hand.  I
upgraded my bpl14 to 18, and added in the extra exits. I didn't want to have
to manually do all the extra exits for the outworld, so I wrote a nice little
command that i had hoped would just toss them in there.  I based it off the
do_dig snippet, and visually it seemed to work fine.  I made a dummy area of
20 rooms, and tested it on the middle ones (so there were valid exits in all
4 standard directions). It made all the exits to the appropiate rooms, but
now if i try to enter, goto, or in anyway get to one of those rooms, the mud
crashes.  This code isn't beautiful, but as far as i can tell, workable.  Any
ideas?  Thanks in advance.

ACMD(do_addextras) {

/* Only works if you have Oasis OLC */

  int i, dir1 = 0, dir2 = 0, dir3 = 0, rroom = 0;


  /* Main stuff */
for (i = 0;i<4;i++) {
    switch (i) {
    case 0:
        dir1 = NORTHEAST;
        dir2 = NORTH;
        dir3 = EAST;
        break;
    case 1:
        dir1 = SOUTHEAST;
        dir2 = EAST;
        dir3 = SOUTH;
        break;
    case 2:
        dir1 = SOUTHWEST;
        dir2 = SOUTH;
        dir3 = WEST;
        break;
    case 3:
        dir1 = NORTHWEST;
        dir2 = NORTH;
        dir3 = WEST;
        break;
    default:
        log("CRAP! do_addextras is broken!");
        return;
    }
    rroom =
world[world[ch->in_room].dir_option[dir2]->to_room].dir_option[dir3]->to_room;
    CREATE(world[rroom].dir_option[rev_dir[dir1]], struct
room_direction_data,1);
    world[rroom].dir_option[rev_dir[dir1]]->general_description = NULL;
    world[rroom].dir_option[rev_dir[dir1]]->keyword = NULL;
    world[rroom].dir_option[rev_dir[dir1]]->to_room = ch->in_room;
    CREATE(world[ch->in_room].dir_option[dir1], struct room_direction_data,1);
    world[ch->in_room].dir_option[dir1]->general_description = NULL;
    world[ch->in_room].dir_option[dir1]->keyword = NULL;
    world[ch->in_room].dir_option[dir1]->to_room = rroom;
}

/* Only works if you have Oasis OLC */

  add_to_save_list(zone_table[world[real_room(ch->in_room)].zone].number,
SL_WLD);

 sprintf(buf, "You add extra exits to room %d.\r\n", ch->in_room);
 send_to_char(buf, ch);
}


Jory Graham
ShaduinMUD

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