20,741
edits
mNo edit summary |
|||
| Line 33: | Line 33: | ||
For example, at the moment we have code in [https://gitorious.org/fg/flightgear/blobs/next/src/Main/options.cxx#line1282 $FG_SRC/Main/options.cxx] which maps the startup parameters to callbacks, which in turn call custom parsers to further process these arguments. What is really needed is a single SGPropertyChangeListener interface class which wraps the concept of a startup/runtime argument, so that all the argument-related code is wrapped inside a single helper class, instead of being spread over many different places in legacy procedural code. | For example, at the moment we have code in [https://gitorious.org/fg/flightgear/blobs/next/src/Main/options.cxx#line1282 $FG_SRC/Main/options.cxx] which maps the startup parameters to callbacks, which in turn call custom parsers to further process these arguments. What is really needed is a single SGPropertyChangeListener interface class which wraps the concept of a startup/runtime argument, so that all the argument-related code is wrapped inside a single helper class, instead of being spread over many different places in legacy procedural code. | ||
Such a class would then register property listeners and it would transparently map its properties to startup arguments, so that the valueChanged() callback will be invoked by FlightGear, regardless of it being invoked during startup or at run time. | |||
Furthermore, it is worth noting that we can significantly reduce the complexity of the options/init handling code by moving code to Nasal space and initializing the Nasal interpreter earlier. This applies especially to all the legacy C++ code setting up property defaults, i.e. see [https://gitorious.org/fg/flightgear/blobs/next/src/Main/options.cxx#line115]. Most of this would be better dealt with in Nasal space. | Furthermore, it is worth noting that we can significantly reduce the complexity of the options/init handling code by moving code to Nasal space and initializing the Nasal interpreter earlier. This applies especially to all the legacy C++ code setting up property defaults, i.e. see [https://gitorious.org/fg/flightgear/blobs/next/src/Main/options.cxx#line115]. Most of this would be better dealt with in Nasal space. | ||