]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGInitialCondition.cpp
Encapsulate the interpolstion version of FGEnvironment and fix some bugs
[flightgear.git] / src / FDM / JSBSim / FGInitialCondition.cpp
index 58d739053263ae76f4e15bcda297c4ee8d1345b7..16a912192476fa3d573d43461b2e1af126b1cb49 100644 (file)
@@ -46,6 +46,7 @@ INCLUDES
 #include "FGFDMExec.h"
 #include "FGState.h"
 #include "FGAtmosphere.h"
+#include "FGAerodynamics.h"
 #include "FGFCS.h"
 #include "FGAircraft.h"
 #include "FGTranslation.h"
@@ -56,6 +57,8 @@ INCLUDES
 #include "FGConfigFile.h"
 #include "FGPropertyManager.h"
 
+namespace JSBSim {
+
 static const char *IdSrc = "$Id$";
 static const char *IdHdr = ID_INITIALCONDITION;
 
@@ -717,19 +720,25 @@ double FGInitialCondition::GetWindDirDegIC(void) {
 
 //******************************************************************************
 
-bool FGInitialCondition::Load(string acpath, string acname, string rstfile)
+bool FGInitialCondition::Load(string rstfile, bool useStoredPath)
 {
   string resetDef;
   string token="";
 
   double temp;
-
-# ifndef macintosh
-  resetDef = acpath + "/" + acname + "/" + rstfile + ".xml";
-# else
-  resetDef = acpath + ";" + acname + ";" + rstfile + ".xml";
-# endif
-
+  # ifndef macintosh
+    string sep = "/";
+  # else
+    string sep = ";";
+  #endif     
+  
+  if( useStoredPath ) {
+    string acpath = fdmex->GetAircraftPath() + sep + fdmex->GetModelName();
+    resetDef = acpath + sep + rstfile + ".xml";
+  } else {
+    resetDef = rstfile;
+  }  
+  
   FGConfigFile resetfile(resetDef);
   if (!resetfile.IsOpen()) {
     cerr << "Failed to open reset file: " << resetDef << endl;
@@ -770,7 +779,7 @@ bool FGInitialCondition::Load(string acpath, string acname, string rstfile)
     resetfile >> token;
   }
 
-  fdmex->RunIC(this);
+  fdmex->RunIC();
   
   return true;
 }
@@ -1014,4 +1023,4 @@ void FGInitialCondition::Debug(int from)
     }
   }
 }
-
+}