]> git.mxchange.org Git - flightgear.git/commitdiff
This is step "1" of probably "many" in the process of separating out the
authorcurt <curt>
Tue, 6 May 2003 23:54:17 +0000 (23:54 +0000)
committercurt <curt>
Tue, 6 May 2003 23:54:17 +0000 (23:54 +0000)
scene management code and organizing it within simgear.  My strategy is
to identify the code I want to move, and break it's direct flightgear
dependencies.  Then it will be free to move over into the simgear package.

- Moved some property specific code into simgear/props/
- Split out the condition code from fgfs/src/Main/fg_props and put it
  in it's own source file in simgear/props/
- Created a scene subdirectory for scenery, model, and material property
  related code.
- Moved location.[ch]xx into simgear/scene/model/
- The location and condition code had dependencies on flightgear's global
  state (all the globals-> stuff, the flightgear property tree, etc.)  SimGear
  code can't depend on it so that data has to be passed as parameters to the
  functions/methods/constructors.
- This need to pass data as function parameters had a dramatic cascading
  effect throughout the FlightGear code.

22 files changed:
src/MultiPlayer/mpplayer.cxx
src/Network/atc610x.cxx
src/Network/generic.cxx
src/Network/httpd.cxx
src/Network/native_ctrls.cxx
src/Network/props.cxx
src/Objects/apt_signs.hxx
src/Objects/matlib.hxx
src/Objects/newmat.cxx
src/Objects/newmat.hxx
src/Objects/obj.hxx
src/Objects/pt_lights.hxx
src/Scenery/tilemgr.cxx
src/Scenery/tilemgr.hxx
src/Sound/fg_fx.cxx
src/Sound/fg_sound.cxx
src/Sound/fg_sound.hxx
src/Systems/electrical.hxx
src/Systems/pitot.hxx
src/Systems/static.hxx
src/Systems/vacuum.hxx
src/WeatherCM/FGLocalWeatherDatabase.h

index adfe19e52e5702ac6c40679b89a31a59dc7417b7..a89e373a794bbdf3a712ae86e77f42ba0784e99a 100644 (file)
@@ -246,7 +246,10 @@ void MPPlayer::LoadModel(void) {
     m_ModelTrans = new ssgTransform;
 
     // Load the model
-    m_Model = globals->get_model_loader()->load_model(m_sModelName);
+    m_Model = globals->get_model_loader()->load_model( globals->get_fg_root(),
+                                                       m_sModelName,
+                                                       globals->get_props(),
+                                                       globals->get_sim_time_sec() );
     m_Model->clrTraversalMaskBits( SSGTRAV_HOT );
 
     // Add model to transform
index d4450a9bac4b80d3c235ac19a779585b88cda4bc..570a603307a70a777e2e64fb85fa73dd0583c06a 100644 (file)
@@ -43,8 +43,8 @@
 #include <simgear/debug/logstream.hxx>
 #include <simgear/io/iochannel.hxx>
 #include <simgear/math/sg_types.hxx>
-#include <simgear/misc/props.hxx>
 #include <simgear/misc/sg_path.hxx>
+#include <simgear/props/props.hxx>
 
 #include <Main/fg_props.hxx>
 #include <Main/globals.hxx>
index c8492cd707284ec643b60921c23c7c0d8ad528ab..d5428b44f20e4dbfbff1a176a86218ba9a5d0b9d 100644 (file)
@@ -25,8 +25,8 @@
 #include <simgear/io/iochannel.hxx>
 #include <simgear/misc/exception.hxx>
 #include <simgear/misc/sg_path.hxx>
-#include <simgear/misc/props.hxx>
-#include <simgear/misc/props_io.hxx>
+#include <simgear/props/props.hxx>
+#include <simgear/props/props_io.hxx>
 
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
index 162bf45ec6ec92816ce0b45f78d8f774205fba58..b020d89f4e14e672466f4b69da28896cc99c80e4 100644 (file)
@@ -40,7 +40,7 @@
 #include <simgear/io/iochannel.hxx>
 #include <simgear/math/sg_types.hxx>
 #include <simgear/misc/commands.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 #include <Main/fg_props.hxx>
 #include <Main/globals.hxx>
index f53dce08f9afb0c08e210145165eafd45da44c3d..6a4d858b2c04d5e4747616f04763baad046ae4a1 100644 (file)
@@ -100,7 +100,6 @@ static void htond (double &x)
 // Populate the FGNetCtrls structure from the property tree.
 void FGProps2NetCtrls( FGNetCtrls *net, bool net_byte_order ) {
     int i;
-    bool b; 
     SGPropertyNode * node;
     SGPropertyNode * tempnode;
 
index eb4e9b0ce281fe3714026c26580a22351a337a7a..51b293177a83f5fafa938f6081715f28e208a1f6 100644 (file)
@@ -31,8 +31,8 @@
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/commands.hxx>
 #include <simgear/misc/strutils.hxx>
-#include <simgear/misc/props.hxx>
-#include <simgear/misc/props_io.hxx>
+#include <simgear/props/props.hxx>
+#include <simgear/props/props_io.hxx>
 
 #include STL_STRSTREAM
 
index 2d77051280b2af878ba495dffbe8658597f4047d..1c0df1c15164a4ff7fe3c2140bef15430727c07a 100644 (file)
 #endif                                   
 
 
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
 #include <simgear/compiler.h>
 
 #include STL_STRING
index 38dd306a2069e720c61b05f7190f05b95f8ac1df..18ed48a6181b979e9046c715b887a77818674a57 100644 (file)
 # error This library requires C++
 #endif                                   
 
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
 #include <simgear/compiler.h>
 
 #include STL_STRING            // Standard C++ string library
index 06a6d59f3fe9eb841aa4490d4d2db7db5fa836bf..7e0fe379d25d309f1dfb77acd1cb8e6a28b6ce6e 100644 (file)
@@ -132,7 +132,11 @@ FGNewMat::Object::load_models () const
                                // Load model only on demand
   if (!_models_loaded) {
     for (unsigned int i = 0; i < _paths.size(); i++) {
-      ssgEntity * entity = globals->get_model_loader()->load_model(_paths[i]);
+      ssgEntity * entity
+        = globals->get_model_loader()->load_model( globals->get_fg_root(),
+                                                   _paths[i],
+                                                   globals->get_props(),
+                                                   globals->get_sim_time_sec());
       if (entity != 0) {
                                 // FIXME: this stuff can be handled
                                 // in the XML wrapper as well (at least,
index 8f52fa6046e6ff8ddee29a46becfc973634cd463..65ccfac85496bc29ee952c531e091fea3ecfd091 100644 (file)
 # error This library requires C++
 #endif                                   
 
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <simgear/compiler.h>
+
+#include STL_STRING      // Standard C++ string library
 
 #include <plib/sg.h>
 #include <plib/ssg.h>
 
-#include <simgear/compiler.h>
-#include <simgear/misc/props.hxx>
-
-#include STL_STRING      // Standard C++ string library
+#include <simgear/props/props.hxx>
 
 SG_USING_STD(string);
 
index eedbd1ff490648dd60d826a8e7976a08594afb58..c4842e82083d632d00e5620a6eee72a23e4fc202 100644 (file)
 #endif                                   
 
 
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
 #include <simgear/compiler.h>
 
 #include STL_STRING
index 7ab4b0211c7b269dd34bef2422c4f2de2299195e..b78117ea307a60095e9e6a98742765d6df691851 100644 (file)
 #endif                                   
 
 
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
 #include <simgear/compiler.h>
 
-#include <vector>              // STL
 #include STL_STRING
+#include <vector>              // STL
 
 #include <plib/sg.h>
 #include <plib/ssg.h>          // plib include
index c5fd377500945b7707afb62da67486d4e5518754..6c0d106efe3ba65b80d7b9a7fcb17c29b1ad3eef 100644 (file)
@@ -281,7 +281,10 @@ void FGTileMgr::update_queues()
         try
         {
             ssgEntity *obj_model =
-                  globals->get_model_loader()->load_model(dm->get_model_path());
+                globals->get_model_loader()->load_model( globals->get_fg_root(),
+                                                         dm->get_model_path(),
+                                                         globals->get_props(),
+                                                         globals->get_sim_time_sec() );
             if ( obj_model != NULL ) {
                 dm->get_obj_trans()->addKid( obj_model );
             }
index 1eb97e70148bf835ce4ea2b46900b4c5acc346ae..34abff2ce709793f359ffc59f2b94a9e15311e51 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <simgear/compiler.h>
 #include <simgear/math/point3d.hxx>
+#include <simgear/scene/model/location.hxx>
 
 #include <queue>
 
@@ -41,8 +42,6 @@
 #  include <simgear/threads/SGQueue.hxx>
 #endif // ENABLE_THREADS
 
-#include <Main/location.hxx>
-
 #include "FGTileLoader.hxx"
 #include "hitlist.hxx"
 #include "newcache.hxx"
index d13a56f81f7f0ad5e13ab14dc5df01f0ad5bd8ec..e56f3912341d3c10be4ee301d370869aad1afcaa 100644 (file)
 #pragma warning (disable: 4786)
 #endif
 
-#include <simgear/misc/props.hxx>
-#include <simgear/misc/sg_path.hxx>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/exception.hxx>
 #ifdef __BORLANDC__
 #  define exception c_exception
 #endif
+#include <simgear/misc/sg_path.hxx>
+#include <simgear/props/props.hxx>
 
 #include <Main/fg_props.hxx>
 
index 867a6e5c8b67dc4eb3a2a2441ad3a75a22915221..1d56cd2e07d36ef343f5c88ec50b4db911dd1ae7 100644 (file)
@@ -31,6 +31,7 @@
 #include <string.h>
 
 #include <simgear/debug/logstream.hxx>
+#include <simgear/props/condition.hxx>
 
 #include <Main/fg_props.hxx>
 
@@ -118,7 +119,7 @@ FGSound::init(SGPropertyNode *node)
    _property = fgGetNode(node->getStringValue("property", ""), true);
    SGPropertyNode *condition = node->getChild("condition");
    if (condition != NULL)
-      _condition = fgReadCondition(condition);
+      _condition = fgReadCondition(globals->get_props(), condition);
 
    if (!_property && !_condition)
       SG_LOG(SG_GENERAL, SG_WARN,
@@ -261,38 +262,34 @@ FGSound::update (double dt)
    // If the state changes to false, stop playing.
    //
    if (_property)
-      curr_value = _property->getDoubleValue();
+       curr_value = _property->getDoubleValue();
 
    if (                                                        // Lisp, anyone?
-         (_condition && !_condition->test()) ||
-         (!_condition && _property &&
-            (
-               !curr_value ||
-               ( (_mode == FGSound::IN_TRANSIT) && (curr_value == _prev_value) )
-            )
+       (_condition && !_condition->test()) ||
+       (!_condition && _property &&
+        (
+         !curr_value ||
+         ( (_mode == FGSound::IN_TRANSIT) && (curr_value == _prev_value) )
          )
-      )
+        )
+       )
    {
-
-      if ((_mode != FGSound::IN_TRANSIT) || (_stopping > MAX_TRANSIT_TIME)) {
-
-         if (_sample->is_playing()) {
-            SG_LOG(SG_GENERAL, SG_INFO, "Stopping audio after " << _dt_play
-                                        << " sec: " << _name );
-
-            _sample->stop( _mgr->get_scheduler() );
-         }
-
-         _active = false;
-         _dt_stop += dt;
-         _dt_play = 0.0;
-
-
-      } else
-         _stopping += dt;
-
-      return;
-
+       if ((_mode != FGSound::IN_TRANSIT) || (_stopping > MAX_TRANSIT_TIME)) {
+           if (_sample->is_playing()) {
+               SG_LOG(SG_GENERAL, SG_INFO, "Stopping audio after " << _dt_play
+                      << " sec: " << _name );
+
+               _sample->stop( _mgr->get_scheduler() );
+           }
+
+           _active = false;
+           _dt_stop += dt;
+           _dt_play = 0.0;
+       } else {
+           _stopping += dt;
+       }
+
+       return;
    }
 
    //
@@ -304,9 +301,9 @@ FGSound::update (double dt)
       if (!_sample->is_playing()) {
          _dt_stop += dt;
          _dt_play = 0.0;
-
-      } else
+      } else {
          _dt_play += dt;
+      }
 
       return;
    }
index d8f71357d7de3823f23c436d302ac2f7d5ce4009..c1aaa567998b4aa4545257fb3b6707489fe4459f 100644 (file)
@@ -28,6 +28,8 @@
 #endif
 
 #include <simgear/compiler.h>
+#include <simgear/props/condition.hxx>
+
 #include <Main/fgfs.hxx>
 #include <Main/globals.hxx>
 
index f36f92af9159d49f3e62cd1b9ec0f1a46ffc3dd2..1668c917187d38da0f6ae0d4cf660ca71d73a504 100644 (file)
@@ -38,7 +38,8 @@
 SG_USING_STD(string);
 SG_USING_STD(vector);
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
 #include <Main/fgfs.hxx>
 
 
index 8d0146fc3d351c1f258f95a10b064c6551d52abd..0024f28827eb97a17972a93b864e7ff21cbb8c5e 100644 (file)
@@ -11,7 +11,8 @@
 # error This library requires C++
 #endif
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
 #include <Main/fgfs.hxx>
 
 
index 0ed4058015428b582594afc54ab824218492e065..df7c650206c4c1557f2856d97a0b132832a40ba3 100644 (file)
@@ -11,7 +11,8 @@
 # error This library requires C++
 #endif
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
 #include <Main/fgfs.hxx>
 
 
index 197b1d1f4955cb033e5267844790f05bf4a90a97..2572c73f993c4add41d647361c52564b91873600 100644 (file)
@@ -11,7 +11,8 @@
 # error This library requires C++
 #endif
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
 #include <Main/fgfs.hxx>
 
 
index 60063fa173bbdc7ae5fe9a04a42f9204e01f44f2..5509fd79699a0b5e28abf14d88c35578ced54581 100644 (file)
@@ -63,7 +63,7 @@ HISTORY
 #include <Main/fgfs.hxx>
 
 #include <simgear/constants.h>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 #include "sphrintp.h"