This should be what you're looking for. Should have to define MAX_RGRID_ROOMS in mud.h. The help says it doesn't copy exits, what it does is create exits within the grid so each room is connected to another in the grid.
The simple help:
Quote: This command allows 3 dimensional patterning of the room you're
currently standing in, using the next available vnums from your
assigned vnum list. (everything but exits are copied. Flags, sector, etc)
i.e. rgrid 10 10 would create 10 by 10 rooms exactly like the one you
are standing in. 10 10 10 would be 3-dimensional, as in, 1000 rooms in a
cube shape.
void do_rgrid( CHAR_DATA *ch, char *argument )
{
char arg [MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char arg3[MAX_INPUT_LENGTH];
EXIT_DATA *xit;
char buf [MAX_STRING_LENGTH];
ROOM_INDEX_DATA *location, *ch_location, *tmp;
AREA_DATA *pArea;
int vnum, maxnum, x, y, z;
int room_count;
int room_hold [MAX_RGRID_ROOMS];
set_char_color( AT_PLAIN, ch );
ch_location = ch->in_room;
pArea = ch->pcdata->area;
argument = one_argument( argument, arg );
argument = one_argument( argument, arg2 );
argument = one_argument( argument, arg3 );
if ( !arg || arg[0] == '\0' )
{
send_to_char( "Create a block of rooms.\n\r", ch );
send_to_char( "Usage: rgrid <x> <y> <z>\n\r", ch );
return;
}
x = atoi(arg);
y = atoi(arg2);
z = atoi(arg3);
if(x < 1 || y < 1) {
send_to_char( "You must specify an x and y of at least 1.\r\n", ch);
return;
}
if(z < 1)
z = 1;
maxnum = x * y * z;
sprintf(buf, "Attempting to create a block of %d rooms, %d x %d x %d.\r\n", maxnum, x, y, z);
send_to_char( buf, ch );
if(maxnum > MAX_RGRID_ROOMS) {
sprintf(buf, "The maximum number of rooms this mud can create at once is %d.\r\n", MAX_RGRID_ROOMS);
send_to_char( buf, ch );
send_to_char( "Please try to create a smaller block of rooms.\r\n", ch);
return;
}
room_count = 0;
send_to_char( "Checking for available rooms...\r\n", ch);
if(pArea->low_r_vnum + maxnum > pArea->hi_r_vnum) {
send_to_char( "You don't even have that many rooms assigned to you.\r\n", ch);
return;
}
for(vnum = pArea->low_r_vnum; vnum <= pArea->hi_r_vnum; vnum++) {
if(get_room_index(vnum) == NULL)
room_count++;
if(room_count >= maxnum)
break;
}
if(room_count < maxnum) {
send_to_char( "There aren't enough free rooms in your assigned range!\r\n", ch);
return;
}
send_to_char( "Enough free rooms were found, creating the rooms...\r\n", ch);
room_count = 0;
vnum = pArea->low_r_vnum;
while(room_count < maxnum) {
if(get_room_index(vnum) == NULL) {
room_hold[room_count++] = vnum;
location = make_room( vnum );
if ( !location ) {
bug( "rgrid: make_room failed", 0 );
return;
}
location->area = ch->pcdata->area;
location->name = ch_location->name;
location->description = ch_location->description;
location->sector_type = ch_location->sector_type;
location->room_flags = ch_location->room_flags;
/*
* Below here you may add anything else you wish to be
* copied into the rgrided rooms.
*/
}
vnum++;
}
send_to_char( "Rooms created, linking the exits...\r\n", ch);
for(room_count = 1; room_count <= maxnum; room_count++) {
vnum = room_hold[room_count - 1];
// Check to see if we can make N exits
if(room_count % x) {
location = get_room_index(vnum);
tmp = get_room_index(room_hold[room_count]);
xit = make_exit( location, tmp, 0 );
xit->keyword = STRALLOC( "" );
xit->description = STRALLOC( "" );
xit->key = -1;
xit->exit_info = 0;
}
// Check to see if we can make S exits
if((room_count - 1) % x) {
location = get_room_index(vnum);
tmp = get_room_index(room_hold[room_count - 2]);
xit = make_exit( location, tmp, 2 );
xit->keyword = STRALLOC( "" );
xit->description = STRALLOC( "" );
xit->key = -1;
xit->exit_info = 0;
}
// Check to see if we can make E exits
if( (room_count - 1) % (x * y) < x * y - x ) {
location = get_room_index(vnum);
tmp = get_room_index(room_hold[room_count + x - 1]);
xit = make_exit( location, tmp, 1 );
xit->keyword = STRALLOC( "" );
xit->description = STRALLOC( "" );
xit->key = -1;
xit->exit_info = 0;
}
// Check to see if we can make W exits
if( ( room_count - 1) % (x * y) >= x ) {
location = get_room_index(vnum);
tmp = get_room_index(room_hold[room_count - x - 1]);
xit = make_exit( location, tmp, 3 );
xit->keyword = STRALLOC( "" );
xit->description = STRALLOC( "" );
xit->key = -1;
xit->exit_info = 0;
}
// Check to see if we can make D exits
if( room_count > x * y ) {
location = get_room_index(vnum);
tmp = get_room_index(room_hold[room_count - x * y - 1]);
xit = make_exit( location, tmp, 5 );
xit->keyword = STRALLOC( "" );
xit->description = STRALLOC( "" );
xit->key = -1;
xit->exit_info = 0;
}
// Check to see if we can make U exits
if( room_count <= maxnum - (x * y) ) {
location = get_room_index(vnum);
tmp = get_room_index(room_hold[room_count + x * y - 1]);
xit = make_exit( location, tmp, 4 );
xit->keyword = STRALLOC( "" );
xit->description = STRALLOC( "" );
xit->key = -1;
xit->exit_info = 0;
}
}
return;
}
|