Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
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
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
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
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Google, Sogou, DotBot

Members: 0
Guests: 13
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » key'd area format
Forum Rules | Mark all | Recent Posts

key'd area format
< Newer Topic :: Older Topic >

Pages:<< prev 1, 2 next >>
Post is unread #1 Sep 2, 2014, 1:14 pm
Go to the top of the page
Go to the bottom of the page

Guest - (Unregistered)

Hello,

Just curious about this.

Why does smaugfuss not have to define AREA_DIR, but it does for other directories in mud.h.

If it is that way for AREA_DIR directory I would assume it could be also for all the other directories.

       
Post is unread #2 Sep 2, 2014, 9:22 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

its because if you look at the startup script it cds into the area directory and treats that like the starting directory :)
       
Post is unread #3 Sep 3, 2014, 10:22 am   Last edited Sep 3, 2014, 10:48 am by Patriot
Go to the top of the page
Go to the bottom of the page

Guest - (Unregistered)

So, I added key'ed area format to my version of smaug code. The outputted files when I folda all looks great!

However, am having an issue with fread_fuss_area cutting off the first letter when I am trying to load the areas.
See the below example:

Wed Sep  3 13:13:49 2014 :: [*****] BUG: fread_fuss_area: Bad section header: ame
Wed Sep  3 13:13:49 2014 :: [*****] FILE: limbo.are LINE: 2
Wed Sep  3 13:13:49 2014 :: [*****] BUG: fread_fuss_area: Bad section header: uthor
Wed Sep  3 13:13:49 2014 :: [*****] FILE: limbo.are LINE: 3
Wed Sep  3 13:13:49 2014 :: [*****] BUG: fread_fuss_area: Bad section header: eatherX
Wed Sep  3 13:13:49 2014 :: [*****] FILE: limbo.are LINE: 4
Wed Sep  3 13:13:49 2014 :: [*****] BUG: fread_fuss_area: Bad section header: eatherY
Wed Sep  3 13:13:49 2014 :: [*****] FILE: limbo.are LINE: 5




// doesn't appear to be making it to fread_fuss_areadata, but rather getting hanged up in fread_fuss_area with it not recognizing AREADATA?
And bugging out at the bottom with invalid header with word chopping off first letter.
      if( !str_cmp( word, "AREADATA" ) )
      {
         if( !tarea )
            tarea = create_area(  );
         fread_fussareadata( fp, tarea );
      }




This is what the area file output looks like,.
#AREADATA
Name         Limbo~
Author       RoD~
WeatherX     0
WeatherY     0
Ranges       soft 1 100 hard 1 100
ResetMsg     A dim pulse of light filters through the swirling mists.~
ResetFreq    60
Flags        noteleport unotsee nodiscovery noinfluence~
#ENDAREADATA


Anyone know what typically is the issue when const char word in a fread cut's off the first letter?
       
Post is unread #4 Sep 4, 2014, 8:46 am
Go to the top of the page
Go to the bottom of the page

Guest - (Unregistered)

In addition to the above question, being so late to the game into looking into key'ed area format. I am wondering why smaugfuss has fwrite_fuss_mobiles and fwrite_mobiles. Why keep old functions? Another example load_char_obj in save.c calls fwrite_object instead of fwrite_fuss_object.

Can't the new key'ed format fuss functions be used to work with those issues, and smaugfuss just get rid of the old calls? Or is that kept in case admin want to use old area format areas? I'd say get rid of those old functions, and let admin build new areas instead of using stock ones.
       
Post is unread #5 Sep 5, 2014, 10:56 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

What does your fread_fuss_area code look like?

Well the area format is different from the things saved in pfiles. like for example equipment location etc has to be handled in pfiles where as in areas its handled in resets so probably a good idea to use the normal functions for them and just update the format for the things you want formated different there.
       
Post is unread #6 Sep 5, 2014, 2:59 pm   Last edited Sep 5, 2014, 5:21 pm by Remcon
Go to the top of the page
Go to the bottom of the page

Guest - (Unregistered)

Hrm code option doesn't seem to be working today for the website.


AREA_DATA *fread_fuss_area( AREA_DATA * tarea, FILE * fp )
{
   for( ;; )
   {
      char letter;
      const char *word;

      letter = fread_letter( fp );
      if( letter == '*' )
      {
         fread_to_eol( fp );
         continue;
      }

      if( letter == '#' )
      {
         bug( "%s: # not found. Invalid format.", __FUNCTION__ );
         if( fBootDb )
            exit( 1 );
         break;
      }

      word = ( feof( fp ) ? "ENDAREA" : fread_word( fp ) );

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

      if( !str_cmp( word, "AREADATA" ) )
      {
         if( !tarea )
            tarea = create_area(  );
         fread_areadata( fp, tarea );
      }
      if( !str_cmp( word, "MOBILE" ) )
         fread_fuss_mobile( fp, tarea );
      else if( !str_cmp( word, "OBJECT" ) )
         fread_fuss_object( fp, tarea );
      else if( !str_cmp( word, "ROOM" ) )
         fread_fuss_room( fp, tarea );
      else if( !str_cmp( word, "ENDAREA" ) )
         break;
      else
      {
         bug( "%s: Bad section header: %s", __FUNCTION__, word );
         fread_to_eol( fp );
      }
   }
   return tarea;
}


use /code instead of \code to end it
       
Post is unread #7 Sep 5, 2014, 5:23 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

what do you have for
fread_fussareadata
       
Post is unread #8 Sep 5, 2014, 5:39 pm   Last edited Sep 5, 2014, 5:40 pm by Patriot
Go to the top of the page
Go to the bottom of the page

Guest - (Unregistered)


void fread_areadata( FILE * fp, AREA_DATA * tarea )
{
   bool fMatch;   // Unused, but needed to shut the compiler up about the KEY macro

   for( ;; )
   {
      const char *word = ( feof( fp ) ? "#ENDAREADATA" : fread_word( fp ) );

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

      fMatch = FALSE;

      switch ( word[0] )
      {
         case '#':
            if( !str_cmp( word, "#ENDAREADATA" ) )
            {
               tarea->age = tarea->reset_frequency;
               return;
            }
            break;

         case 'A':
            KEY( "Author", tarea->author, fread_string( fp ) );
            break;

         case 'F':
            if( !str_cmp( word, "Flags" ) )
            {
               const char *areaflags = NULL;
               char flag[MAX_INPUT_LENGTH];
               int value;

               areaflags = fread_flagstring( fp );

               while( areaflags[0] != '\0' )
               {
                  areaflags = one_argument( areaflags, flag );
                  value = get_areaflag( flag );
                  if( value < 0 || value > 31 )
                     bug( "Unknown area flag: %s", flag );
                  else
                     SET_BIT( tarea->flags, 1 << value );
               }

               fMatch = TRUE;
               break;
            }
            break;

          case 'H':
           if( !str_cmp( word, "HardRanges" ) )
            {
               int x1, x2;
               char *ln;

               ln = fread_line( fp );

               x1 = x2 = 0;
               sscanf( ln, "%d %d", &x1, &x2 );

               tarea->low_hard_range = x1;
               tarea->hi_hard_range = x2;

               fMatch = TRUE;
               break;
            }
           break;

         case 'N':
            KEY( "Name", tarea->name, fread_string_nohash( fp ) );
            break;

         case 'R':
            KEY( "ResetMsg", tarea->resetmsg, fread_string_nohash( fp ) );
            KEY( "ResetFreq", tarea->reset_frequency, fread_number( fp ) );
            break;

         case 'S':
            KEY( "Spelllimit", tarea->spelllimit, fread_number( fp ) );
            if( !str_cmp( word, "SoftRanges" ) )
            {
               int x1, x2;
               char *ln;

               ln = fread_line( fp );

               x1 = x2 = 0;
               sscanf( ln, "%d %d", &x1, &x2 );

               tarea->low_soft_range = x1;
               tarea->hi_soft_range = x2;

               fMatch = TRUE;
               break;
            }

            break;

         case 'V':
            KEY( "Version", tarea->version, fread_number( fp ) );
            break;

         case 'W':
            KEY( "WeatherX", tarea->weatherx, fread_number( fp ) );
            KEY( "WeatherY", tarea->weathery, fread_number( fp ) );
            break;

         default:
            log_printf( "%s: no match: %s", __FUNCTION__, word );
            fread_to_eol( fp );
            fMatch = TRUE;
            break;


      }
      if( !fMatch )
      {
         bug( "%s: unknown word: %s", __FUNCTION__, word );
         fread_to_eol( fp );
      }
   }
}



       
Post is unread #9 Sep 5, 2014, 6:10 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

look for fread_fussareadata :) since thats the part it goes to before fread_fuss_area
       
Post is unread #10 Sep 5, 2014, 6:21 pm   Last edited Sep 5, 2014, 6:22 pm by Patriot
Go to the top of the page
Go to the bottom of the page

Guest - (Unregistered)

my bad.... I had it named fread_areadata instead of fread_fuss_areadata

but fixing that still have same problem.

Fri Sep  5 21:21:41 2014 :: Reading in area files...
(help.are)
Fri Sep  5 21:21:42 2014 :: [*****] BUG: fread_fuss_area: Bad section header: ame
Fri Sep  5 21:21:42 2014 :: [*****] FILE: limbo.are LINE: 2
Fri Sep  5 21:21:42 2014 :: [*****] BUG: fread_fuss_area: Bad section header: uthor
Fri Sep  5 21:21:42 2014 :: [*****] FILE: limbo.are LINE: 3
Fri Sep  5 21:21:42 2014 :: [*****] BUG: fread_fuss_area: Bad section header: eatherX
Fri Sep  5 21:21:42 2014 :: [*****] FILE: limbo.are LINE: 4
Fri Sep  5 21:21:42 2014 :: [*****] BUG: fread_fuss_area: Bad section header: eatherY
Fri Sep  5 21:21:42 2014 :: [*****] FILE: limbo.are LINE: 5
Fri Sep  5 21:21:42 2014 :: [*****] BUG: fread_fuss_area: Bad section header: oftRanges
Fri Sep  5 21:21:42 2014 :: [*****] FILE: limbo.are LINE: 6
Fri Sep  5 21:21:42 2014 :: [*****] BUG: fread_fuss_area: Bad section header: ardRanges
Fri Sep  5 21:21:42 2014 :: [*****] FILE: limbo.are LINE: 7
Fri Sep  5 21:21:42 2014 :: [*****] BUG: fread_fuss_area: Bad section header: esetMsg
Fri Sep  5 21:21:42 2014 :: [*****] FILE: limbo.are LINE: 8
Fri Sep  5 21:21:42 2014 :: [*****] BUG: fread_fuss_area: Bad section header: esetFreq
Fri Sep  5 21:21:42 2014 :: [*****] FILE: limbo.are LINE: 9
Fri Sep  5 21:21:42 2014 :: [*****] BUG: fread_fuss_area: Bad section header: lags
Fri Sep  5 21:21:42 2014 :: [*****] FILE: limbo.are LINE: 10
Fri Sep  5 21:21:42 2014 :: [*****] BUG: fread_fuss_area: # not found. Invalid format.
Fri Sep  5 21:21:42 2014 :: [*****] FILE: limbo.are LINE: 11
       
Post is unread #11 Sep 5, 2014, 6:38 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

well see this is what i want to see the function for


      if( !str_cmp( word, "AREADATA" ) )
      {
         if( !tarea )
            tarea = create_area(  );
         fread_fussareadata( fp, tarea );
      }


So what ever you are sending it to here id like to see that full function please :)
       
Post is unread #12 Sep 5, 2014, 6:45 pm
Go to the top of the page
Go to the bottom of the page

Guest - (Unregistered)


AREA_DATA *fread_fuss_area( AREA_DATA * tarea, FILE * fp )
{
   for( ;; )
   {
      char letter;
      const char *word;

      letter = fread_letter( fp );
      if( letter == '*' )
      {
         fread_to_eol( fp );
         continue;
      }

      if( letter == '#' )
      {
         bug( "%s: # not found. Invalid format.", __FUNCTION__ );
         if( fBootDb )
            exit( 1 );
         break;
      }

      word = ( feof( fp ) ? "ENDAREA" : fread_word( fp ) );

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

      if( !str_cmp( word, "AREADATA" ) )
      {
         if( !tarea )
            tarea = create_area(  );
         fread_fuss_areadata( fp, tarea );
      }
      if( !str_cmp( word, "MOBILE" ) )
         fread_fuss_mobile( fp, tarea );
      else if( !str_cmp( word, "OBJECT" ) )
         fread_fuss_object( fp, tarea );
      else if( !str_cmp( word, "ROOM" ) )
         fread_fuss_room( fp, tarea );
      else if( !str_cmp( word, "ENDAREA" ) )
         break;
      else
      {
         bug( "%s: Bad section header: %s", __FUNCTION__, word );
         fread_to_eol( fp );
      }
   }
   return tarea;
}
       
Post is unread #13 Sep 5, 2014, 6:48 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

ok so what is in the function for fread_fuss_areadata( fp, tarea );
       
Post is unread #14 Sep 5, 2014, 6:50 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

and
change
      if( !str_cmp( word, "AREADATA" ) )
      {
         if( !tarea )
            tarea = create_area(  );
         fread_fuss_areadata( fp, tarea );
      }
      if( !str_cmp( word, "MOBILE" ) )
         fread_fuss_mobile( fp, tarea );

to
      if( !str_cmp( word, "AREADATA" ) )
      {
         if( !tarea )
            tarea = create_area(  );
         fread_fuss_areadata( fp, tarea );
      }
      else if( !str_cmp( word, "MOBILE" ) )
         fread_fuss_mobile( fp, tarea );
       
Post is unread #15 Sep 5, 2014, 7:00 pm   Last edited Sep 5, 2014, 7:01 pm by Patriot
Go to the top of the page
Go to the bottom of the page

Guest - (Unregistered)

void fread_fuss_areadata( FILE * fp, AREA_DATA * tarea )
{
   bool fMatch;   // Unused, but needed to shut the compiler up about the KEY macro

   for( ;; )
   {
      const char *word = ( feof( fp ) ? "#ENDAREADATA" : fread_word( fp ) );

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

      fMatch = FALSE;

      switch ( word[0] )
      {
         case '#':
            if( !str_cmp( word, "#ENDAREADATA" ) )
            {
               tarea->age = tarea->reset_frequency;
               return;
            }
            break;

         case 'A':
            KEY( "Author", tarea->author, fread_string( fp ) );
            break;

         case 'F':
            if( !str_cmp( word, "Flags" ) )
            {
               const char *areaflags = NULL;
               char flag[MAX_INPUT_LENGTH];
               int value;

               areaflags = fread_flagstring( fp );

               while( areaflags[0] != '\0' )
               {
                  areaflags = one_argument( areaflags, flag );
                  value = get_areaflag( flag );
                  if( value < 0 || value > 31 )
                     bug( "Unknown area flag: %s", flag );
                  else
                     SET_BIT( tarea->flags, 1 << value );
               }

               fMatch = TRUE;
               break;
            }
            break;

          case 'H':
           if( !str_cmp( word, "HardRanges" ) )
            {
               int x1, x2;
               char *ln;

               ln = fread_line( fp );

               x1 = x2 = 0;
               sscanf( ln, "%d %d", &x1, &x2 );

               tarea->low_hard_range = x1;
               tarea->hi_hard_range = x2;

               fMatch = TRUE;
               break;
            }
           break;

         case 'N':
            KEY( "Name", tarea->name, fread_string_nohash( fp ) );
            break;

         case 'R':
            KEY( "ResetMsg", tarea->resetmsg, fread_string_nohash( fp ) );
            KEY( "ResetFreq", tarea->reset_frequency, fread_number( fp ) );
            break;

         case 'S':
            KEY( "Spelllimit", tarea->spelllimit, fread_number( fp ) );
            if( !str_cmp( word, "SoftRanges" ) )
            {
               int x1, x2;
               char *ln;

               ln = fread_line( fp );

               x1 = x2 = 0;
               sscanf( ln, "%d %d", &x1, &x2 );

               tarea->low_soft_range = x1;
               tarea->hi_soft_range = x2;

               fMatch = TRUE;
               break;
            }

            break;

         case 'V':
            KEY( "Version", tarea->version, fread_number( fp ) );
            break;

         case 'W':
            KEY( "WeatherX", tarea->weatherx, fread_number( fp ) );
            KEY( "WeatherY", tarea->weathery, fread_number( fp ) );
            break;

         default:
            log_printf( "%s: no match: %s", __FUNCTION__, word );
            fread_to_eol( fp );
            fMatch = TRUE;
            break;


      }
      if( !fMatch )
      {
         bug( "%s: unknown word: %s", __FUNCTION__, word );
         fread_to_eol( fp );
      }
   }
}
       
Post is unread #16 Sep 5, 2014, 7:52 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

did you do the one change i already suggested and try that, id also advise putting in a check to make sure it is making it in to the AREADATA reading part since it seems that it isn't
       
Post is unread #17 Sep 5, 2014, 8:02 pm   Last edited Sep 5, 2014, 8:05 pm by Patriot
Go to the top of the page
Go to the bottom of the page

Guest - (Unregistered)

Yes, I put in the change you said. I know it is not reaching areadata. It appears the reason why it won't reach areadata, is that for some reason word is truncating the first letter. So it never reads areadata, but instead readata So it just gives all those error messages. Now I don't have a clue why that would be happening. Could the fact that I had to use char Newfile[MSL] to bring in AREA_DIR since smaugfuss don't use that, bypassing that with their startup file be an issue?

This guy here...
      word = ( feof( fp ) ? "ENDAREA" : fread_word( fp ) );

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

      if( !str_cmp( word, "AREADATA" ) )
      {
         if( !tarea )
            tarea = create_area(  );
         fread_fuss_areadata( fp, tarea );
      }


My load_area_file looks had to have this added because I use area_dir while smaugfuss does not.
void load_area_file( AREA_DATA * tarea, const char *filename )
{
   char *word;
   char Newfile[MSL], check[MSL];
   int aversion = 0;

    if ( fBootDb )
        tarea = last_area;
    if ( !fBootDb && !tarea ) {
        bug( "%s", "Load_area: null area!" );
        return;
    }

    snprintf( check, MSL, "%s", BUILD_DIR );
    if ( !str_prefix( check, filename ) )
        snprintf( Newfile, MSL, "%s", filename );
    else
        snprintf( Newfile, MSL, "%s%s", AREA_DIR, filename );

    if ( ( fpArea = FileOpen( Newfile, "r" ) ) == NULL ) {
        perror( Newfile );
        bug( "load_area: %s error loading file (can't open)", Newfile );
        return;
    }

   if( fread_letter( fpArea ) != '#' )
   {
      if( fBootDb )
      {
         bug( "%s: No # found at start of area file.", __FUNCTION__ );
         exit( 1 );
      }
      else
      {
         bug( "%s: No # found at start of area file.", __FUNCTION__ );
         FileClose( fpArea );
         fpArea = NULL;
         return;
      }
   }

   word = fread_word( fpArea );

   // New FUSS area format support -- Samson 7/5/07
   if( !str_cmp( word, "AREADATA" ) )
   {
      tarea = fread_fuss_area( tarea, fpArea );
      FileClose( fpArea );
      fpArea = NULL;

      if( tarea )
         process_sorting( tarea );
      return;
   }
       
Post is unread #18 Sep 5, 2014, 8:39 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

try changing
   // New FUSS area format support -- Samson 7/5/07
   if( !str_cmp( word, "AREADATA" ) )
   {
      tarea = fread_fuss_area( tarea, fpArea );

to
   // New FUSS area format support -- Samson 7/5/07
   if( !str_cmp( word, "AREADATA" ) )
   {
      tarea = fread_fuss_areadata( tarea, fpArea );

       
Post is unread #19 Sep 6, 2014, 5:05 am   Last edited Sep 6, 2014, 5:21 am by Patriot
Go to the top of the page
Go to the bottom of the page

Guest - (Unregistered)

Compiling o/db.o
db.c: In function ‘void load_area_file(AREA_DATA*, const char*)’:
db.c:8523:50: error: cannot convert ‘AREA_DATA* {aka area_data*}’ to ‘FILE* {aka _IO_FILE*}’ for argument ‘1’ to ‘void fread_fuss_areadata(FILE*, AREA_DATA*)’
tarea = fread_fuss_areadata( tarea, fpArea );
^
make[1]: *** [o/db.o] Error 1
make: *** [all] Error 2

Didn't work. I think that it is failing to even see AREADATA because word is truncating the first letter. If I change #AREADATA In limbo.are to #AAREADATA it then makes it to load_area_file before bugging out about no # sign on line 2.

Sat Sep  6 08:10:24 2014 :: Reading in area files...
(help.are)
Sat Sep  6 08:10:24 2014 :: [*****] BUG: load_area_file: # not found
Sat Sep  6 08:10:24 2014 :: [*****] FILE: limbo.are LINE: 2
       
Post is unread #20 Sep 6, 2014, 7:03 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

sorry it would be
   // New FUSS area format support -- Samson 7/5/07
   if( !str_cmp( word, "AREADATA" ) )
   {
      tarea = fread_fuss_areadata( fpArea, tarea );

       
Pages:<< prev 1, 2 next >>