Hello. First, an apology. I did not mean to distribute buggy code to the list. I really didn't mean to mail the list so much. Where you to hunt me down and hang me by my tonails over a vat of hot oil, I would understand. Second, the final version of do_dig: ACMD(do_dig) { int iroom, rroom, dir, i, dont_add = 0; struct room_data * temp_room; two_arguments(argument, buf, buf2); if (!*buf2) { send_to_char("Format: dig <dir> <room number>\r\n", ch); return; } iroom = atoi(buf2); rroom = real_room(iroom); dir = search_block(buf, dirs, FALSE); if(dir == -1) { send_to_char("That is not a direction.\r\n", ch); return; } if(world[ch->in_room].dir_option[dir]) { if(world[ch->in_room].dir_option[dir]->to_room != -1) /* is this necessary? */ { send_to_char("An exit already exists in that direction.\r\n", ch); return; } } if (rroom <= 0) { for(i = 0; i <= top_of_zone_table; i++) if(zone_table[i].number == (iroom/100)) break; if(i > top_of_zone_table) { send_to_char("The zone does not exist.\r\n", ch); return; } /* Create and init the room */ CREATE(temp_room, struct room_data, 1); temp_room->name = str_dup("An unfinished room"); temp_room->description = str_dup("You are in an unfinished room.\r\n"); temp_room->number = iroom; temp_room->zone = i; rroom = add_room(temp_room); /* Wham-bam, thank you, ma'am */ free(temp_room->name); free(temp_room->description); free(temp_room); dont_add = 1; } if(world[rroom].dir_option[rev_dir[dir]]) { if(world[rroom].dir_option[rev_dir[dir]]->to_room != -1) /* is this necessary? */ { send_to_char("An exit already exists in that direction.\r\n", ch); return; } } 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; if(!dont_add) add_to_save_list(world[rroom].zone, SL_WLD); sprintf(buf, "You make an exit %s to room %d.\r\n", dirs[dir], iroom); send_to_char(buf, ch); } -- +---------------------------------------------------------------+ | 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/03/01 PST