]> git.mxchange.org Git - flightgear.git/commitdiff
Patches from Tony Peden to separate property XML I/O operations into a
authordavid <david>
Sat, 16 Mar 2002 00:18:38 +0000 (00:18 +0000)
committerdavid <david>
Sat, 16 Mar 2002 00:18:38 +0000 (00:18 +0000)
separate header file.  This change will help integrate properties into
JSBSim.

Also, I (David Megginson) removed most of the SimGear include
statements from globals.hxx, reducing the amount of recompilation
every time SimGear changes.  This required making minor changes to a
lot of files that were depending on the side-effects of the inclusions
in globals.hxx.

25 files changed:
src/Autopilot/auto_gui.cxx
src/Autopilot/newauto.cxx
src/Cockpit/cockpit.cxx
src/Cockpit/hud.cxx
src/FDM/flight.cxx
src/GUI/prop_picker.cxx
src/Main/fg_io.cxx
src/Main/fg_props.cxx
src/Main/fg_props.hxx
src/Main/globals.cxx
src/Main/globals.hxx
src/Main/main.cxx
src/Main/options.cxx
src/Network/garmin.cxx
src/Network/native_fdm.cxx
src/Network/nmea.cxx
src/Network/props.cxx
src/NetworkOLK/network.cxx
src/Objects/matlib.cxx
src/Objects/obj.cxx
src/Scenery/FGTileLoader.cxx
src/Scenery/tilemgr.cxx
src/Time/moonpos.cxx
src/Time/sunpos.cxx
src/Time/tmp.cxx

index 585689094404783120a49ed808b4b347bde763e3..b148bd908f7283850309c8a04009287d73f0f49b 100644 (file)
@@ -28,6 +28,8 @@
 
 #include <simgear/compiler.h>
 
+#include <simgear/route/route.hxx>
+
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
index fb9a37814f4f9b5ffb5b04b751c6c542cca47732..83e601fc67d5339993aebd3644955902b87d0448 100644 (file)
@@ -34,6 +34,7 @@
 #include <simgear/debug/logstream.hxx>
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/math/sg_random.h>
+#include <simgear/route/route.hxx>
 
 #include <Cockpit/steam.hxx>
 #include <Cockpit/radiostack.hxx>
index 6feb75bb348e135a770f4b6a1e3fdfcdd71fbff9..fa2780343f856e49b977dd611a015a804e51f731 100644 (file)
@@ -39,6 +39,7 @@
 #include <simgear/debug/logstream.hxx>
 #include <simgear/math/polar3d.hxx>
 #include <simgear/misc/props.hxx>
+#include <simgear/timing/sg_time.hxx>
 
 #include <Aircraft/aircraft.hxx>
 #include <Include/general.hxx>
index fb7c29d1c0883dac6ef3a0aac7487488af21c2e8..098e755c73a717f1e833824e60faf5f07801b4f1 100644 (file)
@@ -45,6 +45,7 @@
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/props.hxx>
+#include <simgear/misc/sg_path.hxx>
 //#include <simgear/math/fg_random.h>
 //#include <simgear/math/polar3d.hxx>
 
index 22870b3bdb172c9c202b39315f3bcce9750bf745..991e150dd2bd5200ca04945907d3ef92097c1e55 100644 (file)
@@ -407,7 +407,7 @@ FGInterface::unbind ()
 void
 FGInterface::update (int dt)
 {
-    cout << "dummy update() ... SHOULDN'T BE CALLED!" << endl;
+    SG_LOG(SG_FLIGHT, SG_ALERT, "dummy update() ... SHOULDN'T BE CALLED!");
 }
 
 
@@ -525,7 +525,7 @@ void FGInterface::extrapolate( int time_offset ) {
     // -dw- metrowerks complains about ambiguous access, not critical
     // to keep this ;)
 #ifndef __MWERKS__
-    cout << "extrapolating FDM by dt = " << dt << endl;
+    SG_LOG(SG_FLIGHT, SG_INFO, "extrapolating FDM by dt = " << dt);
 #endif
 
     double lat = geodetic_position_v[0] + geocentric_rates_v[0] * dt;
index a7e5c6c07becb5ca0d6d5cfeb3d0d11cf1934117..83e90005c29874e998e56f459553119fff9632e0 100755 (executable)
@@ -39,6 +39,7 @@
 #include <Main/globals.hxx>
 
 #include <simgear/compiler.h>
+#include <simgear/misc/props.hxx>
 
 #define DOTDOTSLASH "../"
 #define SLASH       "/"
index 5e22ce66a59f3fa15c29545cbf7dc242b53a2b4a..9bfff40d211c398019f5a9d6ccb701840e4d0a75 100644 (file)
@@ -90,7 +90,7 @@ static FGProtocol *parse_port_config( const string& config )
        FGATC610x *atc610x = new FGATC610x;
        io = atc610x;
         short_circuit = true;
-       cout << "here ..." << endl;
+       std::cout << "here ..." << endl;
     } else if ( protocol == "atlas" ) {
        FGAtlas *atlas = new FGAtlas;
        io = atlas;
@@ -299,7 +299,7 @@ void fgIOProcess() {
            p->dec_count_down( interval );
            while ( p->get_count_down() < 0 ) {
                p->process();
-               p->dec_count_down( -1000000.0 / p->get_hz() );
+               p->dec_count_down(int( -1000000.0 / p->get_hz()));
            }
        }
     }
index ebbc4bc87a8400291d322d9977f2b0eb823805d0..4d42d8c08a42e4fd7335fa11e0eae807ba12d941 100644 (file)
@@ -25,6 +25,8 @@
 #endif
 
 #include <simgear/misc/exception.hxx>
+#include <simgear/magvar/magvar.hxx>
+#include <simgear/timing/sg_time.hxx>
 
 #include STL_IOSTREAM
 
index 3a612cdb203c9735d434e79123737b772c940e37..e53cc3bf46c5fdfb7bec42ac49a181b0abc46d8a 100644 (file)
@@ -8,6 +8,8 @@
 
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/props.hxx>
+#include <simgear/misc/props_io.hxx>
+
 #include "globals.hxx"
 
 \f
index 1540d7a611ee6db3118877a8725c994965924033..15c898998eacbebf1553a975152fc5b481fa1b9e 100644 (file)
@@ -21,6 +21,8 @@
 // $Id$
 
 
+#include <simgear/misc/commands.hxx>
+
 #include <Environment/environment_mgr.hxx>
 
 #include "globals.hxx"
index 52d58e45105623a06de9d4302ff725d414f446ae..75c119313b6cab8b4f1f28f9420a370101b6d340 100644 (file)
 #include <vector>
 #include STL_STRING
 
-
-#include <simgear/ephemeris/ephemeris.hxx>
-#include <simgear/magvar/magvar.hxx>
-#include <simgear/route/route.hxx>
-#include <simgear/timing/sg_time.hxx>
-#include <simgear/misc/commands.hxx>
-#include <simgear/misc/props.hxx>
-
 #include "viewmgr.hxx"
 
 SG_USING_STD( vector );
@@ -46,6 +38,22 @@ typedef vector<string> string_list;
 
 
 // Forward declarations
+
+// This file is included, directly or indirectly, almost everywhere in
+// FlightGear, so if any of its dependencies changes, most of the sim
+// has to be recompiled.  Using these forward declarations helps us to
+// avoid including a lot of header files (and thus, a lot of
+// dependencies).  Since Most of the methods simply set or return
+// pointers, we don't need to know anything about the class details
+// anyway.
+
+class SGEphemeris;
+class SGMagVar;
+class SGRoute;
+class SGTime;
+class SGPropertyNode;
+class SGCommandMgr;
+
 class FGLogger;
 class FGEnvironmentMgr;
 class FGEnvironment;
@@ -57,7 +65,12 @@ class FGViewer;
 class FGATCMgr;
 class FGATCDisplay;
 
-class FGGlobals {
+
+/**
+ * Bucket for subsystem pointers representing the sim's state.
+ */
+class FGGlobals
+{
 
 private:
 
index e0aa6d70b7d54b67d41b9ea6e6c4630ae285e6e4..1a350a6f773325845547bf3f5e049bf8a8f22e59 100644 (file)
@@ -32,6 +32,8 @@
 
 #include <simgear/compiler.h>
 #include <simgear/misc/exception.hxx>
+#include <simgear/ephemeris/ephemeris.hxx>
+#include <simgear/route/route.hxx>
 
 #ifdef SG_MATH_EXCEPTION_CLASH
 #  include <math.h>
index 52e3f7748121e5ed110a756e68341d6557b94977..2b0122f2eae8a0297f22316b505ce539d6beebbd 100644 (file)
@@ -36,6 +36,9 @@
 #include STL_STRING
 
 #include <simgear/misc/sgstream.hxx>
+#include <simgear/misc/sg_path.hxx>
+#include <simgear/route/route.hxx>
+#include <simgear/route/waypoint.hxx>
 
 // #include <Include/general.hxx>
 // #include <Airports/simple.hxx>
index 45e03c66c211c8e9193fcc54df837c811d8a1dd3..877baca1b5c01bfb75230133c5a53627e241c64b 100644 (file)
@@ -24,6 +24,7 @@
 #include <simgear/debug/logstream.hxx>
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/io/iochannel.hxx>
+#include <simgear/timing/sg_time.hxx>
 
 #include <FDM/flight.hxx>
 #include <Main/globals.hxx>
@@ -144,7 +145,7 @@ bool FGGarmin::gen_message() {
     garmin_sentence += rmz_sum;
     garmin_sentence += "\n";
 
-    cout << garmin_sentence;
+    std::cout << garmin_sentence;
 
     length = garmin_sentence.length();
     strncpy( buf, garmin_sentence.c_str(), length );
index 33566a9d898e43202d764981c4117535ad7033da..9f83f4faba0e2304cd1474b44951afba335676c8 100644 (file)
@@ -28,6 +28,7 @@
 #include <simgear/debug/logstream.hxx>
 #include <simgear/io/lowlevel.hxx> // endian tests
 #include <simgear/io/iochannel.hxx>
+#include <simgear/timing/sg_time.hxx>
 
 #include <FDM/flight.hxx>
 #include <Time/tmp.hxx>
index d6c9726e135b774f5c581b20677aef05c905a3b4..8bb63ee418dc32b3db526a274d2c24eb329d49a7 100644 (file)
@@ -24,6 +24,7 @@
 #include <simgear/debug/logstream.hxx>
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/io/iochannel.hxx>
+#include <simgear/timing/sg_time.hxx>
 
 #include <FDM/flight.hxx>
 #include <Main/globals.hxx>
@@ -144,7 +145,7 @@ bool FGNMEA::gen_message() {
     nmea_sentence += gga_sum;
     nmea_sentence += "\n";
 
-    cout << nmea_sentence;
+    std::cout << nmea_sentence;
 
     length = nmea_sentence.length();
     strncpy( buf, nmea_sentence.c_str(), length );
index 5cdd5c0a44ed8e3728bec44096a940cedc1192e4..bb5c5e57a8c8482f3684bc7259fab6c98cd14d9f 100644 (file)
 // $Id$
 
 
-#include <Main/globals.hxx>
 
 #include <simgear/compiler.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/io/iochannel.hxx>
 #include <simgear/math/sg_types.hxx>
 #include <simgear/misc/props.hxx>
+#include <simgear/misc/props_io.hxx>
+
+#include <Main/globals.hxx>
 
 #include <stdlib.h>            // atoi() atof()
 
@@ -38,6 +40,7 @@
 #if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
 SG_USING_STD(cout);
 SG_USING_STD(istrstream);
+SG_USING_STD(strstream);
 #endif
 
 FGProps::FGProps() {
index d145ed5abc02cec68d8077b499db0679a9553113..ce4e1bbf3ba3e2fb2e1917a9ceb4ca2c09e41fdc 100644 (file)
@@ -63,6 +63,8 @@ extern "C" {
 #include <plib/sg.h>
 #include <plib/ssg.h>
 
+#include <simgear/compiler.h>
+
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
 
index 15a045fb800707340ee7ac6bf846dc5fa651dbe3..272c23fc3fb75a185699286cdcf3ecfd052318cd 100644 (file)
@@ -71,7 +71,7 @@ bool FGMaterialLib::load( const string& mpath ) {
 
   SGPropertyNode materials;
 
-  cout << "Reading materials from " << mpath << endl;
+  SG_LOG(SG_INPUT, SG_INFO, "Reading materials from " << mpath);
   try {
     readProperties(mpath, &materials);
   } catch (const sg_exception &ex) {
index f2470c5db9ed45722b872bd3cbf3373ef5557d74..6b273074b0522a03e6e93b78024c9ff254a17774 100644 (file)
@@ -478,10 +478,8 @@ ssgBranch *fgAsciiObjLoad( const string& path, FGTileEntry *t,
                    string file = path;
                    int pos = file.rfind( "/" );
                    file = file.substr( 0, pos );
-                   cout << "current file = " << file << endl;
                    file += "/";
                    file += material;
-                   cout << "current file = " << file << endl;
                    if ( ! material_lib.add_item( file ) ) {
                        SG_LOG( SG_TERRAIN, SG_ALERT, 
                                "Ack! unknown usemtl name = " << material 
@@ -504,8 +502,6 @@ ssgBranch *fgAsciiObjLoad( const string& path, FGTileEntry *t,
                    tex_height = newmat->get_ysize();
                    state = newmat->get_state();
                    coverage = newmat->get_light_coverage();
-                   // cout << "(w) = " << tex_width << " (h) = " 
-                   //      << tex_width << endl;
                } else {
                    coverage = -1;
                }
@@ -520,8 +516,6 @@ ssgBranch *fgAsciiObjLoad( const string& path, FGTileEntry *t,
        
            in >> token;
 
-           // cout << "token = " << token << endl;
-
            if ( token == "vn" ) {
                // vertex normal
                if ( vncount < FG_MAX_NODES ) {
@@ -634,10 +628,6 @@ ssgBranch *fgAsciiObjLoad( const string& path, FGTileEntry *t,
 
                    in >> n3;
                    fan_vertices.push_back( n3 );
-                   // cout << "  triangle = " 
-                   //      << n1 << "," << n2 << "," << n3 
-                   //      << endl;
-                   // xglNormal3dv(normals[n3]);
                    if ( in.get( c ) && c == '/' ) {
                        in >> tex;
                        fan_tex_coords.push_back( tex );
@@ -767,10 +757,8 @@ ssgLeaf *gen_leaf( const string& path,
        string file = path;
        int pos = file.rfind( "/" );
        file = file.substr( 0, pos );
-       cout << "current file = " << file << endl;
        file += "/";
        file += material;
-       cout << "current file = " << file << endl;
        if ( ! material_lib.add_item( file ) ) {
            SG_LOG( SG_TERRAIN, SG_ALERT, 
                    "Ack! unknown usemtl name = " << material 
@@ -793,19 +781,10 @@ ssgLeaf *gen_leaf( const string& path,
        tex_height = newmat->get_ysize();
        state = newmat->get_state();
        coverage = newmat->get_light_coverage();
-       // cout << "(w) = " << tex_width << " (h) = " 
-       //      << tex_width << endl;
     } else {
        coverage = -1;
     }
 
-    // cout << "before list allocs" << endl;
-
-    // cout << "before vl, size = " << size << endl;
-    // cout << "before nl" << endl;
-    // cout << "before tl" << endl;
-    // cout << "before cl" << endl;
-
     sgVec2 tmp2;
     sgVec3 tmp3;
     sgVec4 tmp4;
@@ -879,14 +858,9 @@ ssgLeaf *gen_leaf( const string& path,
         }
     }
 
-    // cout << "before leaf create" << endl;
     ssgLeaf *leaf = new ssgVtxTable ( ty, vl, nl, tl, cl );
-    // cout << "after leaf create" << endl;
 
     // lookup the state record
-    // cout << "looking up material = " << endl;
-    // cout << material << endl;
-    // cout << "'" << endl;
 
     leaf->setState( state );
 
@@ -919,9 +893,6 @@ bool fgBinObjLoad( const string& path, const bool is_base,
        return false;
     }
 
-    // cout << "fans size = " << obj.get_fans_v().size()
-    //      << " fan_mats size = " << obj.get_fan_materials().size() << endl;
-
     geometry->setName( (char *)path.c_str() );
    
     if ( is_base ) {
@@ -948,7 +919,6 @@ bool fgBinObjLoad( const string& path, const bool is_base,
     group_list pts_v = obj.get_pts_v();
     group_list pts_n = obj.get_pts_n();
     for ( i = 0; i < (int)pts_v.size(); ++i ) {
-        cout << "pts_v.size() = " << pts_v.size() << endl;
        tmp_mat = pt_materials[i];
        if ( tmp_mat.substr(0, 3) == "RWY" ) {
            material = "LIGHTS";
index 07ab8408016b16cb22259a1a68840f715674a342..2e0a01b2b860da2016717a9d4004341a66c3e5cb 100644 (file)
@@ -24,6 +24,8 @@
 #  include <config.h>
 #endif
 
+#include <simgear/compiler.h>
+
 #include <Main/globals.hxx>
 #include "FGTileLoader.hxx"
 #include "tileentry.hxx"
index 4b6cffc7400c8ab19d27c29974c58ac529193f68..bf2bcf8690d20c56318bfad976a2f477ccf99812 100644 (file)
@@ -292,7 +292,6 @@ int FGTileMgr::update( double lon, double lat ) {
     // happen in the render thread because model loading can trigger
     // texture loading which involves use of the opengl api.
     if ( !model_queue.empty() ) {
-        cout << "loading next model ..." << endl;
         // load the next tile in the queue
 #ifdef ENABLE_THREADS
        FGDeferredModel* dm = model_queue.pop();
@@ -312,8 +311,6 @@ int FGTileMgr::update( double lon, double lat ) {
        delete dm;
     }
 
-    // cout << "current elevation (ssg) == " << scenery.get_cur_elev() << endl;
-
     previous_bucket = current_bucket;
     last_longitude = longitude;
     last_latitude  = latitude;
@@ -337,7 +334,6 @@ int FGTileMgr::update( double lon, double lat ) {
        e->add_ssg_nodes( terrain_branch,
                          gnd_lights_branch,
                          rwy_lights_branch );
-       // cout << "Adding ssg nodes for "
     }
 
     sgdVec3 sc;
@@ -349,7 +345,6 @@ int FGTileMgr::update( double lon, double lat ) {
 #if 0
     if ( scenery.center == Point3D(0.0) ) {
        // initializing
-       cout << "initializing scenery current elevation ... " << endl;
        sgdVec3 tmp_abs_view_pos;
 
        Point3D geod_pos = Point3D( longitude * SGD_DEGREES_TO_RADIANS,
@@ -359,7 +354,6 @@ int FGTileMgr::update( double lon, double lat ) {
        scenery.center = tmp;
        sgdSetVec3( tmp_abs_view_pos, tmp.x(), tmp.y(), tmp.z() );
 
-       // cout << "abs_view_pos = " << tmp_abs_view_pos << endl;
        prep_ssg_nodes();
 
        double tmp_elev;
@@ -370,24 +364,8 @@ int FGTileMgr::update( double lon, double lat ) {
        } else {
            scenery.set_cur_elev( 0.0 );
        }
-       cout << "result = " << scenery.get_cur_elev() << endl;
     } else {
 #endif
-        /*
-       cout << "abs view pos = "
-             << globals->get_current_view()->get_abs_view_pos()[0] << ","
-             << globals->get_current_view()->get_abs_view_pos()[1] << ","
-             << globals->get_current_view()->get_abs_view_pos()[2]
-            << " view pos = " 
-             << globals->get_current_view()->get_view_pos()[0] << ","
-             << globals->get_current_view()->get_view_pos()[1] << ","
-             << globals->get_current_view()->get_view_pos()[2]
-             << endl;
-        cout << "current_tile = " << current_tile << endl;
-        cout << "Scenery center = " << sc[0] << "," << sc[1] << "," << sc[2]
-             << endl;
-        */
-
         // overridden with actual values if a terrain intersection is
         // found
        double hit_elev = -9999.0;
@@ -415,8 +393,6 @@ int FGTileMgr::update( double lon, double lat ) {
             scenery.set_cur_radius( 0.0 );
             scenery.set_cur_normal( hit_normal );
         }
-
-       // cout << "Current elevation = " << scenery.get_cur_elev() << endl;
 #if 0
     }
 #endif
@@ -437,11 +413,10 @@ void FGTileMgr::prep_ssg_nodes() {
     tile_cache.reset_traversal();
 
     while ( ! tile_cache.at_end() ) {
-        // cout << "processing a tile" << endl;
         if ( (e = tile_cache.get_current()) ) {
            e->prep_ssg_node( scenery.get_center(), vis);
         } else {
-            cout << "warning ... empty tile in cache" << endl;
+           SG_LOG(SG_INPUT, SG_ALERT, "warning ... empty tile in cache");
         }
        tile_cache.next();
    }
index 1818cdd53623d3148405ee2770ab519a335eebd9..a3bb711df6900fa75bdc090e882dd5f8cc61ebe0 100644 (file)
@@ -59,6 +59,7 @@
 #include <simgear/math/polar3d.hxx>
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/math/vector.hxx>
+#include <simgear/timing/sg_time.hxx>
 
 #include <Main/globals.hxx>
 #include <Main/viewer.hxx>
index c436b1b7d25b8089523c007f3f5c905f595a309c..1fff609cf531304df229648f1947ad528cffde81 100644 (file)
@@ -60,6 +60,7 @@
 #include <simgear/math/polar3d.hxx>
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/math/vector.hxx>
+#include <simgear/timing/sg_time.hxx>
 
 #include <Main/globals.hxx>
 #include <Main/viewer.hxx>
index b15514934bb2ae006d9a0764fda6c6967a50cbcc..806c659ed05e2e385dcc5e227fa80f6033cb2f28 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/magvar/magvar.hxx>
+#include <simgear/timing/sg_time.hxx>
 
 #include <FDM/flight.hxx>
 #include <Main/fg_props.hxx>
@@ -48,11 +49,11 @@ void fgUpdateLocalTime() {
     SGPath zone( globals->get_fg_root() );
     zone.append( "Timezone" );
 
-    cout << "updateLocal("
-         << longitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS
-         << ", "
-         << latitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS
-         << ", " << zone.str() << ")" << endl;
+    SG_LOG(SG_GENERAL, SG_INFO, "updateLocal("
+          << longitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS
+          << ", "
+          << latitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS
+          << ", " << zone.str() << ")");
     globals->get_time_params()->updateLocal( longitude->getDoubleValue()
                                               * SGD_DEGREES_TO_RADIANS, 
                                             latitude->getDoubleValue()