FlightGear run levels: Difference between revisions

Jump to navigation Jump to search
Line 163: Line 163:


Also, many extension functions are specific to certain subsystems, i.e. property tree, sound, FDM, tile manager etc - these would also need to be registered and removed based on the "parent" subsystem's property signals.
Also, many extension functions are specific to certain subsystems, i.e. property tree, sound, FDM, tile manager etc - these would also need to be registered and removed based on the "parent" subsystem's property signals.
== Preventing raw pointer access to subsystems ==
Now, the next problem are obviously all "raw" pointer accesses, i.e. code in the form of:
<syntaxhighlight lang="cpp">
  SGPropertyNode *sim = globals->get_props()->getNode("sim/gui", true);
</syntaxhighlight>
or
<syntaxhighlight lang="cpp">
_route = static_cast<FGRouteMgr*>(globals->get_subsystem("route-manager"));
</syntaxhighlight>
These are problematic because the requested subsystem may not yet be initialized.
So we need to make sure that "optional" subsystems are "clean" in that they are not directly used by any other subsystems.
For starters, it would probably suffice to overload the -> operator for the Globals class and simply allocate the requested subsystems lazily.


== Nasal Scripts ==
== Nasal Scripts ==

Navigation menu