Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!, Yandex, Bing

Members: 0
Guests: 10
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
614
BenitoVirg
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] Where command was not f...
Forum Rules | Mark all | Recent Posts

[Bug] Where command was not finding objects on pfiles
< Newer Topic :: Older Topic > AFKMud 1.77

Pages:<< prev 1 next >>
Post is unread #1 Mar 5, 2006, 12:02 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Bug: Where command was not finding objects on pfiles
Danger: Low - Data returned by the where command could be incomplete.
Discovered in: AFKMud 1.77
Found by: Dwip
Fixed by: Samson

---

pfiles.c, search_pfiles

Replace the function with this:
void search_pfiles( CHAR_DATA *ch, char *dirname, char *filename, int cvnum )
{
   FILE *fpChar;
   char fname[256];

   snprintf( fname, 256, "%s/%s", dirname, filename );
   if( !( fpChar = fopen( fname, "r" ) ) )
   {
      perror( fname );
      return;
   }

   for( ;; )
   {
      int vnum, nest = 0, counter = 1;
      bool done = false, fMatch;

      char letter = fread_letter( fpChar );
      if( letter == '\0' )
      {
         log_printf( "%s: EOF encountered reading file: %s!", __FUNCTION__, fname );
         break;
      }
      
      if( letter != '#' )
         continue;

      const char *word = ( feof( fpChar ) ? "End" : fread_word( fpChar ) );

      if( word[0] == '\0' )
      {
         log_printf( "%s: EOF encountered reading file: %s!", __FUNCTION__, fname );
         word = "End";
      }

      if( !str_cmp( word, "End" ) )
         break;

      if( !str_cmp( word, "OBJECT" ) )
      {
         while( !done )
         {
            word = ( feof( fpChar ) ? "End" : fread_word( fpChar ) );

            if( word[0] == '\0' )
            {
               log_printf( "%s: EOF encountered reading file: %s!", __FUNCTION__, fname );
               word = "End";
            }

            switch( UPPER( word[0] ) )
            {
               default:
                  fread_to_eol( fpChar );
                  break;

               case 'C':
                  KEY( "Count", counter, fread_number( fpChar ) );
                  break;

               case 'E':
                  if( !str_cmp( word, "End" ) )
                  {
                     done = true;
                     break;
                  }

               case 'N':
                  KEY( "Nest", nest, fread_number( fpChar ) );
                  break;

               case 'O':
                  if( !str_cmp( word, "Ovnum" ) )
                  {
                     vnum = fread_number( fpChar );
                     if( !( get_obj_index( vnum ) ) )
                     {
                        bug( "Bad obj vnum in %s: %d", __FUNCTION__, vnum );
                        rent_adjust_pfile( filename );
                     }
                     else
                     {
                        if( vnum == cvnum )
                           pager_printf( ch, "Player %s: Counted %d of Vnum %d.\r\n", filename, counter, cvnum );
                     }
                  }
                  break;
            }
         }
      }
   }
   FCLOSE( fpChar );
   return;
}


This function is used by the where command when searching by vnum for copies of objects. Because of changes to the pfile formats, it quit working. The code for it has now been made more flexible to change, and has also been given protection against corrupted pfiles as well.
       
Pages:<< prev 1 next >>