diff --git a/src/GUI/CanvasWidget.cxx b/src/GUI/CanvasWidget.cxx index f68fe22e4..04adc903f 100644 --- a/src/GUI/CanvasWidget.cxx +++ b/src/GUI/CanvasWidget.cxx @@ -71,7 +71,7 @@ CanvasWidget::CanvasWidget( int x, int y, if( !nasal ) return; - FGNasalSys *nas = dynamic_cast(globals->get_subsystem("nasal")); + FGNasalSys *nas = globals->get_subsystem(); if( !nas ) SG_LOG( SG_GENERAL, SG_ALERT, diff --git a/src/GUI/new_gui.hxx b/src/GUI/new_gui.hxx index a0e4e69af..4ebbdcb2c 100644 --- a/src/GUI/new_gui.hxx +++ b/src/GUI/new_gui.hxx @@ -171,6 +171,7 @@ public: virtual puFont *getDefaultFont() { return _font; } + static const char* subsystemName() { return "gui"; } protected: diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 8537fc373..689aa1707 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -897,8 +897,7 @@ void fgPostInitSubsystems() // Initialize the Nasal interpreter. // Do this last, so that the loaded scripts see initialized state //////////////////////////////////////////////////////////////////////// - FGNasalSys* nasal = new FGNasalSys(); - globals->add_subsystem("nasal", nasal, SGSubsystemMgr::INIT); + FGNasalSys* nasal = globals->add_new_subsystem(SGSubsystemMgr::INIT); nasal->init(); SG_LOG(SG_GENERAL, SG_INFO, "Nasal init took:" << st.elapsedMSec()); diff --git a/src/Scripting/NasalSys.hxx b/src/Scripting/NasalSys.hxx index 096a591be..aa774952c 100644 --- a/src/Scripting/NasalSys.hxx +++ b/src/Scripting/NasalSys.hxx @@ -147,6 +147,8 @@ public: /// output somewhere (a UI, presumably) simgear::BufferedLogCallback* log() const { return _log; } + + static const char* subsystemName() { return "nasal"; } private: //friend class FGNasalScript; friend class FGNasalListener;