diff --git a/simgear/structure/subsystem_mgr.cxx b/simgear/structure/subsystem_mgr.cxx index 8b1d5ea4..9ae7d706 100644 --- a/simgear/structure/subsystem_mgr.cxx +++ b/simgear/structure/subsystem_mgr.cxx @@ -25,6 +25,11 @@ SGSubsystem::init () { } +void +SGSubsystem::postinit () +{ +} + void SGSubsystem::reinit () { @@ -87,6 +92,13 @@ SGSubsystemGroup::init () _members[i]->subsystem->init(); } +void +SGSubsystemGroup::postinit () +{ + for (unsigned int i = 0; i < _members.size(); i++) + _members[i]->subsystem->postinit(); +} + void SGSubsystemGroup::reinit () { @@ -250,6 +262,13 @@ SGSubsystemMgr::init () _groups[i].init(); } +void +SGSubsystemMgr::postinit () +{ + for (int i = 0; i < MAX_GROUPS; i++) + _groups[i].postinit(); +} + void SGSubsystemMgr::reinit () { diff --git a/simgear/structure/subsystem_mgr.hxx b/simgear/structure/subsystem_mgr.hxx index cd612335..03cbbb8d 100644 --- a/simgear/structure/subsystem_mgr.hxx +++ b/simgear/structure/subsystem_mgr.hxx @@ -140,6 +140,18 @@ public: virtual void init (); + /** + * Initialize parts that depend on other subsystems having been initialized. + * + *
This method should set up all parts that depend on other + * subsystems. One example is the scripting/Nasal subsystem, which + * is initialized last. So, if a subsystem wants to execute Nasal + * code in subsystem-specific configuration files, it has to do that + * in its postinit() method.
+ */ + virtual void postinit (); + + /** * Reinitialize the subsystem. * @@ -243,6 +255,7 @@ public: virtual ~SGSubsystemGroup (); virtual void init (); + virtual void postinit (); virtual void reinit (); virtual void bind (); virtual void unbind (); @@ -315,6 +328,7 @@ public: virtual ~SGSubsystemMgr (); virtual void init (); + virtual void postinit (); virtual void reinit (); virtual void bind (); virtual void unbind ();