1
0
Fork 0

Oops, make sure we are generating an ocean tile if we can't load a terrain

tile.
Fixed a warning in the sound manager.
This commit is contained in:
curt 2002-03-11 22:50:23 +00:00
parent 9436f68f56
commit 3df76f9401
3 changed files with 22 additions and 4 deletions

View file

@ -908,10 +908,11 @@ bool fgBinObjLoad( const string& path, const bool is_base,
ssgVertexArray *ground_lights )
{
SGBinObject obj;
bool result = obj.read_bin( path );
if ( !result ) {
if ( ! obj.read_bin( path ) ) {
return false;
} else {
cout << "succeeded: " << path << endl;
}
// cout << "fans size = " << obj.get_fans_v().size()

View file

@ -1043,11 +1043,13 @@ bool FGTileEntry::obj_load( const std::string& path,
// next try the older ascii format, this is some ugly
// weirdness because the ascii loader is *old* and hasn't been
// updated, but hopefully we can can the ascii format soon.
cout << "attempting ascii load generating ocean tile" << endl;
ssgBranch *tmp = fgAsciiObjLoad( path, this, ground_lights, is_base );
if ( tmp ) {
return tmp;
} else {
// default to an ocean tile
cout << "generating ocean tile" << endl;
if ( fgGenTile( path, tile_bucket, &c, &br, geometry ) ) {
center = c;
bounding_radius = br;
@ -1255,6 +1257,21 @@ FGTileEntry::load( const SGPath& base, bool is_base )
in >> ::skipws;
}
}
} else {
// no .stg file, generate an ocean tile on the fly for this
// area
ssgBranch *geometry = new ssgBranch;
Point3D c;
double br;
if ( fgGenTile( basename.str(), tile_bucket, &c, &br, geometry ) ) {
center = c;
bounding_radius = br;
new_tile -> addKid( geometry );
} else {
delete geometry;
SG_LOG( SG_TERRAIN, SG_ALERT,
"Warning: failed to generate ocean tile!" );
}
}
if ( new_tile != NULL ) {

View file

@ -272,7 +272,7 @@ FGSound::update (int dt)
if ((_type == FGSound::LEVEL) || (_type == FGSound::INVERTED)) {
int check = (_offset + _property->getFloatValue() * _factor);
bool check = (int)(_offset + _property->getFloatValue() * _factor);
if (_type == FGSound::INVERTED)
check = !check;
@ -297,7 +297,7 @@ FGSound::update (int dt)
} else { // FLIPFLOP, RAISE, FALL
int check = (_offset + _property->getFloatValue() * _factor);
bool check = (int)(_offset + _property->getFloatValue() * _factor);
if ((bool)check == _active)
return;