I am having a problem with something.  
I want to output to file a list of all mob vnums 
Their kill totals and the total times they have been killed.

When I let the update run, I get the following in the file....

    2     0     0
^M


Here is the code.  Can someone let me know what I'm doing wrong?
It should print out all existing mob vnums but it won't.  Unless
I am looking at it wrong(which I probably am)

void mobstat_update (void)
{
     FILE *fp;
     int vnum;
     MOB_INDEX_DATA *pMobIndex;
     CHAR_DATA *mob;
     char buf[MSL];

    fclose(fpReserve);

    fp = fopen("../data/mobstat.txt","w");

    for (vnum = 0; nMatch < top_mob_index; vnum++)
    if ((pMobIndex = get_mob_index(vnum)) != NULL)
    {
      if ( ( pMobIndex = get_mob_index( vnum ) ) != NULL )
      {
       mob = create_mobile( pMobIndex );
       sprintf(buf,"%5d %5d %5d\n\r", mob->pIndexData->vnum,
mob->pIndexData->kills, mob->pIndexData->killed);
       fprintf( fp, buf );
      }

     fclose(fp);
     fpReserve = fopen( NULL_FILE, "r" );
     return;
    }
}


Ive also tried hardcoding a number for top_mob_index (32768) but to no
avail.
Cheers,
-K

Reply via email to