diff --git a/src/Aircraft/replay.hxx b/src/Aircraft/replay.hxx index 36c305105..fd3f751ea 100644 --- a/src/Aircraft/replay.hxx +++ b/src/Aircraft/replay.hxx @@ -75,6 +75,7 @@ public: bool saveTape(const SGPropertyNode* ConfigData); bool loadTape(const SGPropertyNode* ConfigData); + static const char* subsystemName() { return "reply"; } private: void clear(); FGReplayData* record(double time); diff --git a/src/FDM/fdm_shell.hxx b/src/FDM/fdm_shell.hxx index f9047fe65..e4b32ab5a 100644 --- a/src/FDM/fdm_shell.hxx +++ b/src/FDM/fdm_shell.hxx @@ -42,19 +42,21 @@ class FDMShell : public SGSubsystem { public: FDMShell(); - virtual ~FDMShell(); + ~FDMShell() override; - virtual void init(); - virtual void shutdown(); - virtual void reinit(); - virtual void postinit(); - - virtual void bind(); - virtual void unbind(); + void init() override; + void shutdown() override; + void reinit() override; + void postinit() override; - virtual void update(double dt); + void bind() override; + void unbind() override; + + void update(double dt) override; FGInterface* getInterface() const; + + static const char* subsystemName() { return "flight"; } private: void createImplementation(); diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 191b9cc45..c618cec9b 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -981,7 +981,7 @@ void fgCreateSubsystems(bool duringReset) { //////////////////////////////////////////////////////////////////// // Initialize the replay subsystem //////////////////////////////////////////////////////////////////// - globals->add_subsystem("replay", new FGReplay); + globals->add_new_subsystem<FGReplay>(SGSubsystemMgr::GENERAL); globals->add_subsystem("history", new FGFlightHistory); #ifdef ENABLE_AUDIO_SUPPORT @@ -1065,7 +1065,7 @@ void fgStartReposition() fgSetBool("/sim/signals/reinit", true); fgSetBool("/sim/crashed", false); - FDMShell* fdm = static_cast<FDMShell*>(globals->get_subsystem("flight")); + FDMShell* fdm = globals->get_subsystem<FDMShell>(); fdm->unbind(); // update our position based on current presets @@ -1080,10 +1080,10 @@ void fgStartReposition() } // Initialize the FDM - globals->get_subsystem("flight")->reinit(); + globals->get_subsystem<FDMShell>()->reinit(); // reset replay buffers - globals->get_subsystem("replay")->reinit(); + globals->get_subsystem<FGReplay>()->reinit(); // ugly: finalizePosition waits for METAR to arrive for the new airport. // we don't re-init the environment manager here, since historically we did @@ -1096,9 +1096,9 @@ void fgStartReposition() envMgr->get_subsystem("realwx")->reinit(); } - // need to bind FDMshell again, since we manually unbound it above... + // need to bind FDMshell again fdm->bind(); - + // need to reset aircraft (systems/instruments/autopilot) // so they can adapt to current environment globals->get_subsystem("systems")->reinit(); diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 3f8315412..0f3916c64 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -1556,7 +1556,7 @@ fgOptLoadTape(const char* arg) node->removeChangeListener( this ); // tell the replay subsystem to load the tape - FGReplay* replay = (FGReplay*) globals->get_subsystem("replay"); + FGReplay* replay = globals->get_subsystem<FGReplay>(); SGPropertyNode_ptr arg = new SGPropertyNode(); arg->setStringValue("tape", _tape.utf8Str() ); arg->setBoolValue( "same-aircraft", 0 );