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:
parent
9436f68f56
commit
3df76f9401
3 changed files with 22 additions and 4 deletions
|
@ -908,10 +908,11 @@ bool fgBinObjLoad( const string& path, const bool is_base,
|
||||||
ssgVertexArray *ground_lights )
|
ssgVertexArray *ground_lights )
|
||||||
{
|
{
|
||||||
SGBinObject obj;
|
SGBinObject obj;
|
||||||
bool result = obj.read_bin( path );
|
|
||||||
|
|
||||||
if ( !result ) {
|
if ( ! obj.read_bin( path ) ) {
|
||||||
return false;
|
return false;
|
||||||
|
} else {
|
||||||
|
cout << "succeeded: " << path << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cout << "fans size = " << obj.get_fans_v().size()
|
// cout << "fans size = " << obj.get_fans_v().size()
|
||||||
|
|
|
@ -1043,11 +1043,13 @@ bool FGTileEntry::obj_load( const std::string& path,
|
||||||
// next try the older ascii format, this is some ugly
|
// next try the older ascii format, this is some ugly
|
||||||
// weirdness because the ascii loader is *old* and hasn't been
|
// weirdness because the ascii loader is *old* and hasn't been
|
||||||
// updated, but hopefully we can can the ascii format soon.
|
// 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 );
|
ssgBranch *tmp = fgAsciiObjLoad( path, this, ground_lights, is_base );
|
||||||
if ( tmp ) {
|
if ( tmp ) {
|
||||||
return tmp;
|
return tmp;
|
||||||
} else {
|
} else {
|
||||||
// default to an ocean tile
|
// default to an ocean tile
|
||||||
|
cout << "generating ocean tile" << endl;
|
||||||
if ( fgGenTile( path, tile_bucket, &c, &br, geometry ) ) {
|
if ( fgGenTile( path, tile_bucket, &c, &br, geometry ) ) {
|
||||||
center = c;
|
center = c;
|
||||||
bounding_radius = br;
|
bounding_radius = br;
|
||||||
|
@ -1255,6 +1257,21 @@ FGTileEntry::load( const SGPath& base, bool is_base )
|
||||||
in >> ::skipws;
|
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 ) {
|
if ( new_tile != NULL ) {
|
||||||
|
|
|
@ -272,7 +272,7 @@ FGSound::update (int dt)
|
||||||
|
|
||||||
if ((_type == FGSound::LEVEL) || (_type == FGSound::INVERTED)) {
|
if ((_type == FGSound::LEVEL) || (_type == FGSound::INVERTED)) {
|
||||||
|
|
||||||
int check = (_offset + _property->getFloatValue() * _factor);
|
bool check = (int)(_offset + _property->getFloatValue() * _factor);
|
||||||
if (_type == FGSound::INVERTED)
|
if (_type == FGSound::INVERTED)
|
||||||
check = !check;
|
check = !check;
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ FGSound::update (int dt)
|
||||||
|
|
||||||
} else { // FLIPFLOP, RAISE, FALL
|
} else { // FLIPFLOP, RAISE, FALL
|
||||||
|
|
||||||
int check = (_offset + _property->getFloatValue() * _factor);
|
bool check = (int)(_offset + _property->getFloatValue() * _factor);
|
||||||
if ((bool)check == _active)
|
if ((bool)check == _active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue