1
0
Fork 0

Changes to track Bernie's updates to fgstream.

This commit is contained in:
curt 1998-11-06 14:46:59 +00:00
parent 197b94fcf4
commit ad3ae51348
6 changed files with 53 additions and 36 deletions

View file

@ -219,10 +219,10 @@ fgAptGenerate(const string& path, fgTILE *tile)
apt_id = ""; apt_id = "";
// read in each line of the file // read in each line of the file
in.eat_comments(); in >> skipcomment;
while ( ! in.eof() ) while ( ! in.eof() )
{ {
in.stream() >> token; in >> token;
if ( token == "a" ) { if ( token == "a" ) {
// airport info record (start of airport) // airport info record (start of airport)
@ -234,7 +234,7 @@ fgAptGenerate(const string& path, fgTILE *tile)
} }
cout << "Reading airport record\n"; cout << "Reading airport record\n";
in.stream() >> apt_id; in >> apt_id;
apt_name = ""; apt_name = "";
i = 1; i = 1;
avex = avey = avez = 0.0; avex = avey = avez = 0.0;
@ -250,7 +250,7 @@ fgAptGenerate(const string& path, fgTILE *tile)
// out of the base terrain. The points are given in // out of the base terrain. The points are given in
// counter clockwise order and are specified in lon/lat // counter clockwise order and are specified in lon/lat
// degrees. // degrees.
in.stream() >> p; in >> p;
avex += tile->nodes[i][0]; avex += tile->nodes[i][0];
avey += tile->nodes[i][1]; avey += tile->nodes[i][1];
avez += tile->nodes[i][2]; avez += tile->nodes[i][2];
@ -262,8 +262,7 @@ fgAptGenerate(const string& path, fgTILE *tile)
while ( in.get(c) && c != '\n' ); while ( in.get(c) && c != '\n' );
} }
// airports.insert(a); in >> skipcomment;
in.eat_comments();
} }
if ( apt_id != "" ) { if ( apt_id != "" ) {
@ -282,6 +281,9 @@ fgAptGenerate(const string& path, fgTILE *tile)
// $Log$ // $Log$
// Revision 1.8 1998/11/06 14:46:59 curt
// Changes to track Bernie's updates to fgstream.
//
// Revision 1.7 1998/10/20 18:26:06 curt // Revision 1.7 1998/10/20 18:26:06 curt
// Updates to point3d.hxx // Updates to point3d.hxx
// //

View file

@ -65,12 +65,12 @@ int fgAIRPORTS::load( const string& file ) {
*/ */
// read in each line of the file // read in each line of the file
in.eat_comments(); in >> skipcomment;
while ( ! in.eof() ) while ( ! in.eof() )
{ {
in.stream() >> a; in >> a;
airports.insert(a); airports.insert(a);
in.eat_comments(); in >> skipcomment;
} }
return 1; return 1;
@ -109,6 +109,9 @@ fgAIRPORTS::~fgAIRPORTS( void ) {
// $Log$ // $Log$
// Revision 1.8 1998/11/06 14:47:01 curt
// Changes to track Bernie's updates to fgstream.
//
// Revision 1.7 1998/09/08 21:38:41 curt // Revision 1.7 1998/09/08 21:38:41 curt
// Changes by Bernie Bright. // Changes by Bernie Bright.
// //

View file

@ -94,10 +94,10 @@ int fgStarsInit( void ) {
// read in each line of the file // read in each line of the file
while ( ! in.eof() && starcount < FG_MAX_STARS ) while ( ! in.eof() && starcount < FG_MAX_STARS )
{ {
in.eat_comments(); in >> skipcomment;
string name; string name;
getline( in.stream(), name, ',' ); getline( in, name, ',' );
in.stream() >> starlist[starcount]; in >> starlist[starcount];
++starcount; ++starcount;
} }
@ -252,6 +252,9 @@ void fgStarsRender( void ) {
// $Log$ // $Log$
// Revision 1.20 1998/11/06 14:47:02 curt
// Changes to track Bernie's updates to fgstream.
//
// Revision 1.19 1998/10/16 23:27:21 curt // Revision 1.19 1998/10/16 23:27:21 curt
// C++-ifying. // C++-ifying.
// //

View file

@ -477,18 +477,18 @@ int fgOPTIONS::parse_config_file( const string& path ) {
fgPrintf( FG_GENERAL, FG_INFO, "Processing config file: %s\n", fgPrintf( FG_GENERAL, FG_INFO, "Processing config file: %s\n",
path.c_str() ); path.c_str() );
in.eat_comments(); in >> skipcomment;
while ( !in.eof() ) while ( !in.eof() )
{ {
string line; string line;
getline( in.stream(), line ); getline( in, line );
if ( parse_option( line ) == FG_OPTIONS_ERROR ) { if ( parse_option( line ) == FG_OPTIONS_ERROR ) {
fgPrintf( FG_GENERAL, FG_EXIT, fgPrintf( FG_GENERAL, FG_EXIT,
"Config file parse error: %s '%s'\n", "Config file parse error: %s '%s'\n",
path.c_str(), line.c_str() ); path.c_str(), line.c_str() );
} }
in.eat_comments(); in >> skipcomment;
} }
return FG_OPTIONS_OK; return FG_OPTIONS_OK;
@ -573,6 +573,9 @@ fgOPTIONS::~fgOPTIONS( void ) {
// $Log$ // $Log$
// Revision 1.28 1998/11/06 14:47:03 curt
// Changes to track Bernie's updates to fgstream.
//
// Revision 1.27 1998/11/02 23:04:04 curt // Revision 1.27 1998/11/02 23:04:04 curt
// HUD units now display in feet by default with meters being a command line // HUD units now display in feet by default with meters being a command line
// option. // option.

View file

@ -286,18 +286,18 @@ fgMATERIAL_MGR::load_lib ( void )
// printf("%s", line); // printf("%s", line);
// strip leading white space and comments // strip leading white space and comments
in.eat_comments(); in >> skipcomment;
// set to zero to prevent its value accidently being '{' // set to zero to prevent its value accidently being '{'
// after a failed >> operation. // after a failed >> operation.
char token = 0; char token = 0;
in.stream() >> material_name >> token; in >> material_name >> token;
if ( token == '{' ) { if ( token == '{' ) {
printf( " Loading material %s\n", material_name.c_str() ); printf( " Loading material %s\n", material_name.c_str() );
fgMATERIAL m; fgMATERIAL m;
in.stream() >> m; in >> m;
if ( current_options.get_textures() ) { if ( current_options.get_textures() ) {
m.load_texture(); m.load_texture();
@ -357,6 +357,9 @@ fgMATERIAL_MGR::render_fragments()
// $Log$ // $Log$
// Revision 1.9 1998/11/06 14:47:05 curt
// Changes to track Bernie's updates to fgstream.
//
// Revision 1.8 1998/10/12 23:49:17 curt // Revision 1.8 1998/10/12 23:49:17 curt
// Changes from NHV to make the code more dynamic with fewer hard coded limits. // Changes from NHV to make the code more dynamic with fewer hard coded limits.
// //

View file

@ -167,35 +167,35 @@ int fgObjLoad( const string& path, fgTILE *t) {
stopwatch.start(); stopwatch.start();
// ignore initial comments and blank lines. (priming the pump) // ignore initial comments and blank lines. (priming the pump)
in.eat_comments(); in >> skipcomment;
while ( ! in.eof() ) while ( ! in.eof() )
{ {
string token; string token;
in.stream() >> token; in >> token;
// printf("token = %s\n", token.c_str() ); // printf("token = %s\n", token.c_str() );
if ( token == "gbs" ) if ( token == "gbs" )
{ {
// reference point (center offset) // reference point (center offset)
in.stream() >> t->center >> t->bounding_radius; in >> t->center >> t->bounding_radius;
center = t->center; center = t->center;
} }
else if ( token == "bs" ) else if ( token == "bs" )
{ {
// reference point (center offset) // reference point (center offset)
in.stream() >> fragment.center; in >> fragment.center;
in.stream() >> fragment.bounding_radius; in >> fragment.bounding_radius;
} }
else if ( token == "vn" ) else if ( token == "vn" )
{ {
// vertex normal // vertex normal
if ( vncount < MAX_NODES ) { if ( vncount < MAX_NODES ) {
in.stream() >> normals[vncount][0] in >> normals[vncount][0]
>> normals[vncount][1] >> normals[vncount][1]
>> normals[vncount][2]; >> normals[vncount][2];
vncount++; vncount++;
} else { } else {
fgPrintf( FG_TERRAIN, FG_EXIT, fgPrintf( FG_TERRAIN, FG_EXIT,
@ -206,9 +206,9 @@ int fgObjLoad( const string& path, fgTILE *t) {
{ {
// node (vertex) // node (vertex)
if ( t->ncount < MAX_NODES ) { if ( t->ncount < MAX_NODES ) {
in.stream() >> t->nodes[t->ncount][0] in >> t->nodes[t->ncount][0]
>> t->nodes[t->ncount][1] >> t->nodes[t->ncount][1]
>> t->nodes[t->ncount][2]; >> t->nodes[t->ncount][2];
t->ncount++; t->ncount++;
} else { } else {
fgPrintf( FG_TERRAIN, FG_EXIT, fgPrintf( FG_TERRAIN, FG_EXIT,
@ -249,7 +249,7 @@ int fgObjLoad( const string& path, fgTILE *t) {
// scan the material line // scan the material line
string material; string material;
in.stream() >> material; in >> material;
fragment.tile_ptr = t; fragment.tile_ptr = t;
// find this material in the properties list // find this material in the properties list
@ -273,7 +273,7 @@ int fgObjLoad( const string& path, fgTILE *t) {
n1 = n2 = n3 = n4 = 0; n1 = n2 = n3 = n4 = 0;
// fgPrintf( FG_TERRAIN, FG_DEBUG, " new tri strip = %s", line); // fgPrintf( FG_TERRAIN, FG_DEBUG, " new tri strip = %s", line);
in.stream() >> n1 >> n2 >> n3; in >> n1 >> n2 >> n3;
fragment.add_face(n1, n2, n3); fragment.add_face(n1, n2, n3);
// fgPrintf( FG_TERRAIN, FG_DEBUG, "(t) = "); // fgPrintf( FG_TERRAIN, FG_DEBUG, "(t) = ");
@ -351,7 +351,7 @@ int fgObjLoad( const string& path, fgTILE *t) {
if ( isdigit(c) ) if ( isdigit(c) )
{ {
in.putback(c); in.putback(c);
in.stream() >> n4; in >> n4;
break; break;
} }
} }
@ -389,7 +389,7 @@ int fgObjLoad( const string& path, fgTILE *t) {
} }
// fgPrintf( FG_TERRAIN, FG_DEBUG, "new triangle = %s", line);*/ // fgPrintf( FG_TERRAIN, FG_DEBUG, "new triangle = %s", line);*/
in.stream() >> n1 >> n2 >> n3; in >> n1 >> n2 >> n3;
fragment.add_face(n1, n2, n3); fragment.add_face(n1, n2, n3);
// xglNormal3d(normals[n1][0], normals[n1][1], normals[n1][2]); // xglNormal3d(normals[n1][0], normals[n1][1], normals[n1][2]);
@ -419,7 +419,7 @@ int fgObjLoad( const string& path, fgTILE *t) {
// fgPrintf( FG_TERRAIN, FG_DEBUG, "continued tri strip = %s ", // fgPrintf( FG_TERRAIN, FG_DEBUG, "continued tri strip = %s ",
// line); // line);
in.stream() >> n1; in >> n1;
// There can be one or two values // There can be one or two values
char c; char c;
@ -431,7 +431,7 @@ int fgObjLoad( const string& path, fgTILE *t) {
if ( isdigit(c) ) if ( isdigit(c) )
{ {
in.putback(c); in.putback(c);
in.stream() >> n2; in >> n2;
break; break;
} }
} }
@ -511,7 +511,7 @@ int fgObjLoad( const string& path, fgTILE *t) {
// eat comments and blank lines before start of while loop so // eat comments and blank lines before start of while loop so
// if we are done with useful input it is noticed before hand. // if we are done with useful input it is noticed before hand.
in.eat_comments(); in >> skipcomment;
} }
if ( in_fragment ) { if ( in_fragment ) {
@ -553,6 +553,9 @@ int fgObjLoad( const string& path, fgTILE *t) {
// $Log$ // $Log$
// Revision 1.9 1998/11/06 14:47:06 curt
// Changes to track Bernie's updates to fgstream.
//
// Revision 1.8 1998/10/20 18:33:55 curt // Revision 1.8 1998/10/20 18:33:55 curt
// Tweaked texture coordinates, but we still have some problems. :-( // Tweaked texture coordinates, but we still have some problems. :-(
// //