Implementing VNAV support in FlightGear: Difference between revisions

Jump to navigation Jump to search
Line 200: Line 200:


It is foreseeable that we may need to modify and extend JSBSim, i.e. to add new components - unfortunately, the "Extending JSBSim" chapter in the JSBSim reference manual is still just a placeholder without any content, so here are some stubs to help lower the barrier to entry when extending JSBSim.
It is foreseeable that we may need to modify and extend JSBSim, i.e. to add new components - unfortunately, the "Extending JSBSim" chapter in the JSBSim reference manual is still just a placeholder without any content, so here are some stubs to help lower the barrier to entry when extending JSBSim.
=== Standalone JSBSim ===
The standalone JSBSim interpreter is implemented in src/JSBSim.cpp - all options processing takes place in '''bool options(int count, char **arg)''', this is also the place where you can easily add new startup options, see for example:
<syntaxhighlight lang="diff">
diff --git a/src/JSBSim.cpp b/src/JSBSim.cpp
index 2a8b225..0dfa52d 100644
--- a/src/JSBSim.cpp
+++ b/src/JSBSim.cpp
@@ -680,8 +680,10 @@ bool options(int count, char **arg)
        exit(1);
      }
-    }
-    else //Unknown keyword so print the help file, the bad keyword and abort
+    } else if (keyword == "--new-option") {
+      std::cerr << "--new-option= works (value is:"<< value << ")- but not yet implemented-exiting!" << std::endl;
+      exit(1);
+    } else //Unknown keyword so print the help file, the bad keyword and abort
    {
          PrintHelp();
          cerr << "The argument \"" << keyword << "\" cannot be interpreted as a file name or option." << endl;
@@ -735,8 +737,8 @@ void PrintHelp(void)
    cout << "    --simulation-rate=<rate (double)> specifies the sim dT time or frequency" << endl;
    cout << "                      If rate specified is less than 1, it is interpreted as" << endl;
    cout << "                      a time step size, otherwise it is assumed to be a rate in Hertz." << endl;
-    cout << "    --end=<time (double)> specifies the sim end time" << endl << endl;
-
+    cout << "    --end=<time (double)> specifies the sim end time" << endl;
+    cout << "    --new-option=(value) a  new JSBSim option" << endl << endl;
    cout << "  NOTE: There can be no spaces around the = sign when" << endl;
    cout << "        an option is followed by a filename" << endl << endl;
}
</syntaxhighlight>


=== Adding new Telnet commands ===
=== Adding new Telnet commands ===

Navigation menu