Welcome to the Builder Academy

Question dig north *

More
26 Aug 2018 09:22 #8194 by prool
dig north * was created by prool
Hello, collegues,

I made option for command 'dig'

dig direction *

Creates a new room with the first free number

Code:

ACMD(do_dig)
{
char sdir[MAX_INPUT_LENGTH], sroom[MAX_INPUT_LENGTH], *new_room_name;
room_vnum rvnum = NOWHERE;
room_rnum rrnum = NOWHERE;
zone_rnum zone;
int dir = 0, rawvnum;
struct descriptor_data *d = ch->desc; /* will save us some typing */

/* Grab the room's name (if available). */
new_room_name = two_arguments(argument, sdir, sroom);
skip_spaces(&new_room_name);

/* Can't dig if we don't know where to go. */
if (!*sdir || !*sroom) {
send_to_char(ch, "Format: dig <direction> <room> - to create an exit\r\n"
" dig <direction> -1 - to delete an exit\r\n"
" dig <direction> * - to create an exit to next free vnum\r\n");
return;
}

if (*sroom=='*') { // by prool
int r, i, z, j, rnum;
r = GET_ROOM_VNUM(IN_ROOM(ch));
z = r / 100;
//printf("prooldebug: do_dig() room %i zone %i\n",r,z);
for (i=0;i<100;i++) {
j=z*100+i;
rnum=real_room(j);
//printf("#%i %c ", j, (rnum!=NOWHERE)?'+':'-');
if (rnum==NOWHERE) {rawvnum=j; rvnum=j; rrnum=NOWHERE; break;}
else if (i==99) {send_to_char(ch,"This zone is full\r\n"); return; }
}
//printf("\n");

} else { // *sroom != '*'
rawvnum = atoi(sroom);
if (rawvnum == -1)
rvnum = NOWHERE;
else
rvnum = (room_vnum)rawvnum;
rrnum = real_room(rvnum);
}


Further lines without changes

With best regards, Prool

With best regards, Prool
The following user(s) said Thank You: Chime

Please Log in or Create an account to join the conversation.

Time to create page: 0.256 seconds