if ( !str_cmp( arg1, "grid" ) ) {
if ( is_number( arg2 ) )
{
value = atol( arg2 );
if ( value < 0 || value > 100 ) { ptransmit( "Invalid grid size, should be 0-100.\r\n", ch ); return; }
if ( !IS_BUILDER( ch, pZone ) )
{
ptransmit( "Cannot dig a scene in a zone of which you are not a builder.\r\n", ch ); return;
}
{ long x,y,created=0;
long grid[value*value];
SCENE_INDEX_DATA *g_scene;
for ( x=0; x < value; x++ )
for ( y=0; y < value; y++ ) {
char buf[MAX_INPUT_LENGTH];
grid[x+y*value] = first_available_scene_vnum( pZone );
if ( grid[x+y*value] < 0 ) continue;
sprintf( buf, "screate %ld", grid[x+y*value] );
redit( ch, buf );
g_scene = get_scene_index( grid[x+y*value] ); // Set terrain info
if ( !g_scene ) continue;
g_scene->sector_type = pScene->sector_type;
g_scene->scene_flags = pScene->scene_flags;
g_scene->template = pScene->vnum;
g_scene->name = str_dup( pScene->name );
};
// Connect grid
for ( x=0; x < value; x++ )
for ( y=0; y < value; y++ ) {
long dir;
g_scene = get_scene_index( grid[x+y*value] );
if ( !g_scene ) continue;
// Connect to grid, set terrain type.
created++;
for ( dir =0; dir<MAX_DIR; dir++ ) {
char rbuf[50];
long to_xy=(x+dir_grid_x[dir])+(y+dir_grid_y[dir])*value;
if ( dir==DIR_UP || dir==DIR_DOWN || to_xy < 0 || to_xy >= value*value ) continue;
sprintf( rbuf, "%ld", grid[to_xy] );
redit_exit( ch, g_scene, dir, rbuf, "", TRUE );
}
};
if ( created == value*value )
ptransmit( "Grid generated.\r\n", ch );
else ptransmit( "Only part of the grid has been generated.", ch );
SET_BIT( pZone->zone_flags, ZONE_CHANGED );
}
} else ptransmit( "Syntax: grid [size]\r\n(creates a grid of sizeXsize using zone's available vnums)\r\n", ch );
return;
}
/*
* The version info. Please use this info when reporting bugs.
* It is displayed in the game by typing 'version' while editing.
* Do not remove these from the code - by request of Jason Dinkel
*/
#define VERSION "ILAB Online Creation [Beta 1.0, ROM 2.3 modified]\n\r" \
" Port a ROM 2.4 v1.8\n\r"
#define AUTHOR " By Jason(jdinkel@mines.colorado.edu)\n\r" \
" Modified for use with ROM 2.3\n\r" \
" By Hans Birkeland (hansbi@ifi.uio.no)\n\r" \
" Modificado para uso en ROM 2.4b6\n\r" \
" Por Ivan Toledo (itoledo@ctcreuna.cl)\n\r"
#define DATE " (Apr. 7, 1995 - ROM mod, Apr 16, 1995)\n\r" \
" (Port a ROM 2.4 - Nov 2, 1996)\n\r" \
" Version actual : 1.8 - Sep 8, 1998\n\r"
#define CREDITS " Original by Surreality(cxw197@psu.edu) and Locke(locke@lm.com)"
#define VERSION "ILAB Online Creation [Beta 1.0, ROM 2.3 modified]\n\r" \
" Port to ROM 2.4 v1.00\n\r"
#define AUTHOR " By Jason(jdinkel@mines.colorado.edu)\n\r" \
" Modified for use with ROM 2.3\n\r" \
" By Hans Birkeland (hansbi@ifi.uio.no)\n\r" \
" Modified for use with ROM 2.4b4a\n\r" \
" By Birdie (itoledo@ramses.centic.utem.cl)\n\r" \
" Security Modifications and additions\n\r" \
" By David Leverich 2000 - present\n\r"
#define DATE " (Apr. 7, 1995 - ROM mod, Apr 16, 1995)\n\r" \
" (Port a ROM 2.4 - Nov 2, 1996)\n\r" \
" Version actual : 1.5a - Mar 9, 1997\n\r"
#define CREDITS " Original by Surreality(cxw197@psu.edu) and Locke(locke@lm.com)"
void do_connect( CHAR_DATA *ch, char *argument )
{
char arg1 [MAX_INPUT_LENGTH];
char arg2 [MAX_INPUT_LENGTH];
extern sh_int rev_dir[];
int vnum;
int direction = -1;
bool fOneway = FALSE;
ROOM_INDEX_DATA *pRoomIndex;
EXIT_DATA *pexit = NULL;
if ( IS_NPC( ch ) )
return;
if ( !can_build( ch, ch->in_room->area ) )
{
send_to_char(
"You do not have authorization to build in this zone.\n\r", ch );
return;
}
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' || arg2[0] == '\0' )
{
send_to_char(" Syntax: connect <direction> <vnum> [oneway]\n\r", ch );
send_to_char(" [oneway] is optional parameter. Exits are two way\n\r", ch );
send_to_char(" by default. Anything other than 'oneway' in that\n\r", ch );
send_to_char(" field will be ignored.\n\r", ch );
return;
}
if ( !is_number( arg2 ) )
{
send_to_char("Target room vnum must be numeric.\n\r", ch );
return;
}
vnum = atoi( arg2 );
direction = get_direction( arg1 );
if ( direction == -1 )
{
do_connect( ch, "" );
return;
}
if ( !str_cmp( argument, "oneway" ) || !str_cmp( argument, "one" ) )
fOneway = TRUE;
if ( (pRoomIndex = get_room_index( vnum )) == NULL )
{
send_to_char("Target room number does not exist.\n\r", ch );
return;
}
if ( (pexit = ch->in_room->exit[direction]) == NULL )
{
pexit = (EXIT_DATA *) alloc_perm( sizeof(*pexit) );
pexit->to_room = pRoomIndex;
pexit->description = str_dup( "\0" );
pexit->keyword = str_dup( "\0" );
pexit->exit_flags = 0;
pexit->key = 0;
pexit->vnum = vnum;
ch->in_room->exit[direction] = pexit;
}
else
{
if ( pexit->to_room != NULL )
{
send_to_char("Exit already exists.\n\r", ch );
return;
}
pexit->to_room = pRoomIndex;
pexit->vnum = vnum;
}
if ( !fOneway )
{
if ( (pexit = pRoomIndex->exit[rev_dir[direction]]) == NULL )
{
pexit = (EXIT_DATA *) alloc_perm( sizeof(*pexit) );
pexit->to_room = ch->in_room;
pexit->description = str_dup( "\0" );
pexit->keyword = str_dup( "\0" );
pexit->exit_flags = 0;
pexit->key = 0;
pexit->vnum = ch->in_room->vnum;
pRoomIndex->exit[rev_dir[direction]] = pexit;
}
else
{
if ( pexit->to_room != NULL )
{
send_to_char("Reverse exit already exists. Forward entrance only created.\n\r", ch );
return;
}
pexit->to_room = ch->in_room;
pexit->vnum = ch->in_room->vnum;
}
}
send_to_char("Exit connected.\n\r", ch );
char_from_room( ch );
char_to_room( ch, pRoomIndex, FALSE );
do_look( ch, "auto" );
return;
}
Autodig is a function added for easy area creation and mapping.
How to use:
First, Autodig must be enabled. When it is, in redit,
you can simply move in any direction and it creates and digs
to the next unused vnum in the area.