Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, DotBot, Yandex

Members: 0
Guests: 17
Stats
Files
Topics
Posts
Members
Newest Member
481
3,735
19,370
618
Micheal64X
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,643
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 >>