1
0
Fork 0

Code cleanups while checking reposition performance

Some C++11 fixes and give FDMShell, Reply a subsystem-name
This commit is contained in:
James Turner 2018-09-09 13:42:51 +01:00
parent f39b81c872
commit 72239c9a52
4 changed files with 19 additions and 16 deletions

View file

@ -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);

View file

@ -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();

View file

@ -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();

View file

@ -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 );