]> git.mxchange.org Git - flightgear.git/blobdiff - JSBsim/FGState.cpp
Latest changes from Jon, plus ...
[flightgear.git] / JSBsim / FGState.cpp
index c6a904702d9e1356f542f02fd4e55a5a55fa222d..92ffa9de41a946335c1ed534ac10fcde7541937f 100644 (file)
@@ -36,7 +36,16 @@ HISTORY
 INCLUDES
 *******************************************************************************/
 
-#include <math.h>
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <cmath>
+#  else
+#    include <math.h>
+#  endif
+#else
+#  include <cmath>
+#endif
 
 #include "FGState.h"
 #include "FGFDMExec.h"
@@ -73,18 +82,18 @@ FGState::~FGState(void)
 }
 
 
-bool FGState::Reset(char* fname)
+bool FGState::Reset(string path, string fname)
 {
-  char resetDef[256];
+  string resetDef;
   float U, V, W;
   float phi, tht, psi;
   float alpha, beta, gamma;
   float Q0, Q1, Q2, Q3;
   float T[4][4];
 
-  sprintf(resetDef, "/h/curt/projects/FlightGear/Simulator/FDM/JSBsim/aircraft/%s/%s", FDMExec->GetAircraft()->GetAircraftName(), fname);
+  resetDef = path + "/" + FDMExec->GetAircraft()->GetAircraftName() + "/" + fname;
 
-  ifstream resetfile(resetDef);
+  ifstream resetfile(resetDef.c_str());
 
   if (resetfile) {
     resetfile >> U;
@@ -152,9 +161,9 @@ bool FGState::Reset(char* fname)
 }
 
 
-bool FGState::StoreData(char* fname)
+bool FGState::StoreData(string fname)
 {
-  ofstream datafile(fname);
+  ofstream datafile(fname.c_str());
 
   if (datafile) {
     datafile << FDMExec->GetTranslation()->GetU();
@@ -175,9 +184,9 @@ bool FGState::StoreData(char* fname)
 }
 
 
-bool FGState::DumpData(char* fname)
+bool FGState::DumpData(string fname)
 {
-  ofstream datafile(fname);
+  ofstream datafile(fname.c_str());
 
   if (datafile) {
     datafile << "U: " << FDMExec->GetTranslation()->GetU() << endl;