I have been looking at the area file code and trying to make the area files that it creates more readable. I like what samson has done with the fuss area files, and while i wont take it to that degree, i will make it easier for myself ro read things out of the area files.
Now, i was looking at these 2 sections and the code that is used to load the data from file and noticed that while economy is put all in one line and uses fread_number that the flags are put on a separate line and sscanf to read in the data.
#FLAGS
0 60
#ECONOMY 0 24199980
So what i would like to know, is there in real terms why they cannot both use fread_number as all they both do is read a few numbers from the area file. Or is there some fundamental difference that im not quite grasping hold of here.
Now, i was looking at these 2 sections and the code that is used to load the data from file and noticed that while economy is put all in one line and uses fread_number that the flags are put on a separate line and sscanf to read in the data.
#FLAGS
0 60
#ECONOMY 0 24199980
void load_economy( AREA_DATA * tarea, FILE * fp )
{
if ( !tarea )
{
bug( "Load_economy: no #AREANAME seen yet." );
if ( fBootDb )
{
shutdown_mud( "No #AREANAME" );
exit( 1 );
}
else
return;
}
tarea->high_economy = fread_number( fp );
tarea->low_economy = fread_number( fp );
return;
}
void load_flags( AREA_DATA * tarea, FILE * fp )
{
char *ln;
int x1, x2;
if ( !tarea )
{
bug( "Load_flags: no #AREANAME seen yet." );
if ( fBootDb )
{
shutdown_mud( "No #AREANAME" );
exit( 1 );
}
else
return;
}
ln = fread_line( fp );
x1 = x2 = 0;
sscanf( ln, "%d %d", &x1, &x2 );
tarea->flags = x1;
tarea->reset_frequency = x2;
if ( x2 )
tarea->age = x2;
return;
}
So what i would like to know, is there in real terms why they cannot both use fread_number as all they both do is read a few numbers from the area file. Or is there some fundamental difference that im not quite grasping hold of here.