]> git.mxchange.org Git - flightgear.git/commitdiff
Oops, make sure we are generating an ocean tile if we can't load a terrain
authorcurt <curt>
Mon, 11 Mar 2002 22:50:23 +0000 (22:50 +0000)
committercurt <curt>
Mon, 11 Mar 2002 22:50:23 +0000 (22:50 +0000)
tile.
Fixed a warning in the sound manager.

src/Objects/obj.cxx
src/Scenery/tileentry.cxx
src/Sound/fg_sound.cxx

index 769000d2e3643a5934f001b6794721f3ac9e9e09..5a78d63ed08c18784d5b1a439dd753c59487428d 100644 (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()
index a163960917998b2c6ee3939d050302da70c1bb5d..a1bbf12d5c181610ed417d0d7d6443aa371c784e 100644 (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 ) {
index aa22b6fed01cfc8be933735aaadffe60c40e17c8..9d193cc0c43ad9729f27f2d08a999e76f83f194c 100644 (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;