alist.txt
snippets · 2.0 KB · 2010-03-30
alist (Spanish text): lists areas with their vnums without needing OLC installed.
Download « Back to the snippets list
Este snippets es para hacer una lista de las areas con los vnum, pero sin necesidad de tener un OLC instalado.
Solo has de cambiar esto
/*/En interp.c añadir/*/
{ "alist", do_alist, POS_DEAD, ML, LOG_NORMAL, 1 },
/*/En interp.h añadir/*/
DECLARE_DO_FUN( do_alist );
Y donde tu quieras
void do_alist(CHAR_DATA *ch, char *argument)
{
FILE *fp;
BUFFER *buffer;
AREA_DATA *parea;
ROOM_INDEX_DATA *from_room;
char buf[MAX_STRING_LENGTH];
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
int iHash;
bool found = FALSE;
argument = one_argument(argument, arg1);
argument = one_argument(argument, arg2);
if (arg1[0] == '\0')
{
if (arg2[0] != '\0')
{
fclose(fpReserve);
if( (fp = fopen(arg2, "w")) == NULL)
{
send_to_char("Error abriendo fichero.\n\r",ch);
fclose(fp);
fpReserve = fopen(NULL_FILE, "r");
fp = NULL;
}
}
else
fp = NULL;
if (!fp)
buffer = new_buf();
send_to_char( " Areas Vnum Min - Vnum Max\n\r" ,ch);
send_to_char( " {y*{g*{r*{y*{g*{r*{y*{g*{r*{y*{g*{r*{y*{g*{r*{y*{g*{r*{y*{g*{r*{y*{g*{r*{y*{g*{r*{y*{g*{r*{y*{g*{r*{y*{g*{r*{y*{g*{r*{y*{g*{r*{y*{g*{r*{y*{g*{r*\n\r",ch);
for (parea = area_first; parea != NULL; parea = parea->next)
{
sprintf(buf, "{y*{g*{r* {b%-20s {W%8d a %8d {r*{g*{y*{x\n\r",
parea->name, parea->min_vnum, parea->max_vnum);
fp ? fprintf(fp, buf) : add_buf(buffer, buf);
found = FALSE;
for(iHash = 0; iHash < MAX_KEY_HASH; iHash++)
{
for( from_room = room_index_hash[iHash];
from_room != NULL;
from_room = from_room->next )
{
if ( from_room->vnum < parea->min_vnum
|| from_room->vnum > parea->max_vnum )
continue;
}
}
}
if (!fp)
{
page_to_char(buf_string(buffer), ch);
free_buf(buffer);
}
else
{
fclose(fp);
fpReserve = fopen(NULL_FILE, "r");
}
return;
}
}
Espero que te sirva Un saludo Dubi...