]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGScript.cpp
JSBSim updates. This update changes the file format, so an update of the base
[flightgear.git] / src / FDM / JSBSim / FGScript.cpp
index 796f2c338a2299078dd21f24c1c052e3f8cea610..f17221325dad15764aa2618cf94caad4f9aefe8a 100644 (file)
@@ -86,7 +86,7 @@ FGScript::~FGScript()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-bool FGScript::LoadScript(string script)
+bool FGScript::LoadScript( string script )
 {
   FGConfigFile Script(script);
   string token="";
@@ -108,14 +108,14 @@ bool FGScript::LoadScript(string script)
   ScriptName = Script.GetValue("name");
   Scripted = true;
 
-  if (debug_lvl > 0) cout << "Reading Script File " << ScriptName << endl;
+  if (debug_lvl > 0) cout << "Reading and running from script file " << ScriptName << endl << endl;
 
   while (Script.GetNextConfigLine() != string("EOF") && Script.GetValue() != string("/runscript")) {
     token = Script.GetValue();
     if (token == "use") {
       if ((token = Script.GetValue("aircraft")) != string("")) {
         aircraft = token;
-        result = FDMExec->LoadModel("aircraft", "engine", aircraft);
+        result = FDMExec->LoadModel(aircraft);
         if (!result) {
           cerr << "Aircraft file " << aircraft << " was not found" << endl;
           exit(-1);
@@ -143,12 +143,12 @@ bool FGScript::LoadScript(string script)
           newCondition = new struct condition();
           while (token != string("/when")) {
             if (token == "parameter") {
-              prop_name = State->GetPropertyName( Script.GetValue("name") );
+              prop_name = Script.GetValue("name");
               newCondition->TestParam.push_back( PropertyManager->GetNode(prop_name) );
               newCondition->TestValue.push_back(strtod(Script.GetValue("value").c_str(), NULL));
               newCondition->Comparison.push_back(Script.GetValue("comparison"));
             } else if (token == "set") {
-              prop_name = State->GetPropertyName( Script.GetValue("name") );
+              prop_name = Script.GetValue("name");
               newCondition->SetParam.push_back( PropertyManager->GetNode(prop_name) );
               newCondition->SetValue.push_back(strtod(Script.GetValue("value").c_str(), NULL));
               newCondition->Triggered.push_back(false);
@@ -204,8 +204,8 @@ bool FGScript::LoadScript(string script)
   Debug(4);
 
 
-  FGInitialCondition IC(FDMExec);
-  if ( ! IC.Load("aircraft", aircraft, initialize)) {
+  FGInitialCondition *IC=FDMExec->GetIC();
+  if ( ! IC->Load( initialize )) {
     cerr << "Initialization unsuccessful" << endl;
     exit(-1);
   }