|
Roomlink (Another) [by Angus Mezick] |
|
|
|
Posted Wednesday, August 12th @ 11:36:08 PM, by George Greer in the Zones dept.
Added Jul 6, 1998. Click the link below to read it or download it.
From: Angus Mezick <angus@EDGIL.CCMAIL.COMPUSERVE.COM>
Subject: show connection
I don't know if i posted this before but here is a nice little util i came
up for finding what zones connected to a ceretain zone. I leave it up to
you to do the show connection part of the command.
void show_connections(struct char_data *ch,char *arg)
{
int zone_num;
int j,i,k,tele_targ;
int start_room;
char *buf;
if (!*arg)
{
send_to_char("USAGE: show connections .\r\n",ch);
send_to_char("USAGE: show connections <zone_num>\r\n",ch);
return;
}
else if (*arg=='.')
zone_num=world[ch->in_room].zone;
else
{
j=atoi(arg);
for(zone_num=0;zone_num<=top_of_zone_table;zone_num++)
if(zone_table[zone_num].number==j)
break;
}
if(zone_num>=0 && zone_num <=top_of_zone_table)
{
buf=get_buffer(32750);
start_room=zone_table[zone_num].number*100;
sprintf(buf,"Connections from %-30.30s\r\n"
"----------------------------------------------------------------------\r\n",
zone_table[zone_num].name);
for(i=0,k=0;i<=top_of_world;i++)
{
for(j=0;j<NUM_OF_DIRS;j++)
{
if(world[i].zone==zone_num &&
world[i].dir_option[j] &&
world[i].dir_option[j]->to_room!=-1 &&
world[world[i].dir_option[j]->to_room].zone!=zone_num)
{
sprintf(buf+strlen(buf),"%3d: [%5d] %-23.23s -(%-5.5s)-> [%5d] %-23.2
3s\r\n",++k,
world[i].number, world[i].name,dirs[j],
world[world[i].dir_option[j]->to_room].number,
world[world[i].dir_option[j]->to_room].name);
}
}
if((world[i].zone==zone_num) &&
world[i].tele &&
(world[i].tele->targ!=0))
{
if(((tele_targ=real_room(world[i].tele->targ))>=0)&&
(world[tele_targ].zone!=zone_num))
{
sprintf(buf+strlen(buf),"%3d: [%5d] %-23.23s -(%-5.5s)-> [%5d] %-23.2
3s\r\n",++k,
world[i].number, world[i].name,"tport",
world[tele_targ].number,
world[tele_targ].name);
}
}
}
sprintf(buf+strlen(buf),"\r\nConnections to %-30.30s\r\n"
"----------------------------------------------------------------------\r\n",
zone_table[zone_num].name);
for(i=0,k=0;i<=top_of_world;i++)
{
for(j=0;j<NUM_OF_DIRS;j++)
{
if(world[i].zone!=zone_num &&
world[i].dir_option[j] &&
world[i].dir_option[j]->to_room!=-1 &&
world[world[i].dir_option[j]->to_room].zone==zone_num)
{
sprintf(buf+strlen(buf),"%3d: [%5d] %-23.23s -(%-5.5s)-> [%5d] %-23.2
3s\r\n",++k,
world[i].number, world[i].name,dirs[j],
world[world[i].dir_option[j]->to_room].number,
world[world[i].dir_option[j]->to_room].name);
}
}
if((world[i].zone!=zone_num) &&
world[i].tele &&
(world[i].tele->targ!=0))
{
if(((tele_targ=real_room(world[i].tele->targ))>=0)&&
(world[tele_targ].zone==zone_num))
{
sprintf(buf+strlen(buf),"%3d: [%5d] %-23.23s -(%-5.5s)-> [%5d] %-23.2
3s\r\n",++k,
world[i].number, world[i].name,"tport",
world[tele_targ].number,
world[tele_targ].name);
}
}
}
for(i=0;i<=top_of_objt;i++)
{
if((obj_proto[i].obj_flags.type_flag==ITEM_PORTAL) &&
(obj_proto[i].obj_flags.value[0]!=0))
{
if(((tele_targ=real_room(obj_proto[i].obj_flags.value[0]))>=0) &&
(world[tele_targ].zone==zone_num))
sprintf(buf+strlen(buf),"%3d: [%5d] %-23.23s -(%-5.5s)-> [%5d] %-23.2
3s\r\n",++k,
obj_index[i].virtual,
obj_proto[i].short_description,
"prtal",
world[tele_targ].number,
world[tele_targ].name);
}
}
if(ch->desc)
page_string(ch->desc,buf,1);
release_buffer(buf);
return;
}
}
<< Roomlink [by Brian Guilbault] | Reply | View as text | Flattened | Room Saving [by Reza Nejad] >> |
|
Related Links |
|
|
|
CircleMUD Snippets |
|
|
Note: Not all of these snippets will work perfectly with
your version of code, so be prepared to fix one
or two bugs that may arise, and please let me know
what you needed to do to fix it. Sending a corrected
version is always welcome.
|
Finally, if you wish to use any of the snippets from this
page, you are more than welcome, just mention the
authors in your credits. If you wish to release any
of these snippets to the public on another site,
contact me FIRST.
|
|
|
|
|
|
|