Re: [CODE] do_dig modifications for OasisOLC

From: Ron Martin (rmartin@deepthought.org)
Date: 01/08/01


>
> In which case buf2 will still be empty and so a check for (!*buf2) will
> return true, just like you want.

Sorry.  I read that incorrectly.  I understand now.  How's this:

ACMD(do_dig)
{
        int iroom, rroom, dir, i;
        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])
        {
                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 = iroom/100;
                rroom = add_room(temp_room);
                /* Wham-bam, thank you, ma'am */
                free(temp_room->name);
                free(temp_room->description);
                free(temp_room);
        }

        if(world[rroom].dir_option[rev_dir[dir]])
        {
                send_to_char("An exit already exists from 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;

        add_to_save_list(iroom/100, SL_WLD);

        sprintf(buf, "You make an exit %s to room %d.\r\n", dirs[dir], iroom);
        send_to_char(buf, ch);
}

Looking for further prodding....

Ron

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