1
0
Fork 0

More safe subsystem accessors.

This commit is contained in:
James Turner 2016-09-27 05:58:39 -05:00
parent 52b91d4863
commit 2ff476a217
4 changed files with 5 additions and 3 deletions

View file

@ -71,7 +71,7 @@ CanvasWidget::CanvasWidget( int x, int y,
if( !nasal ) if( !nasal )
return; return;
FGNasalSys *nas = dynamic_cast<FGNasalSys*>(globals->get_subsystem("nasal")); FGNasalSys *nas = globals->get_subsystem<FGNasalSys>();
if( !nas ) if( !nas )
SG_LOG( SG_GENERAL, SG_LOG( SG_GENERAL,
SG_ALERT, SG_ALERT,

View file

@ -171,6 +171,7 @@ public:
virtual puFont *getDefaultFont() { return _font; } virtual puFont *getDefaultFont() { return _font; }
static const char* subsystemName() { return "gui"; }
protected: protected:

View file

@ -897,8 +897,7 @@ void fgPostInitSubsystems()
// Initialize the Nasal interpreter. // Initialize the Nasal interpreter.
// Do this last, so that the loaded scripts see initialized state // Do this last, so that the loaded scripts see initialized state
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
FGNasalSys* nasal = new FGNasalSys(); FGNasalSys* nasal = globals->add_new_subsystem<FGNasalSys>(SGSubsystemMgr::INIT);
globals->add_subsystem("nasal", nasal, SGSubsystemMgr::INIT);
nasal->init(); nasal->init();
SG_LOG(SG_GENERAL, SG_INFO, "Nasal init took:" << st.elapsedMSec()); SG_LOG(SG_GENERAL, SG_INFO, "Nasal init took:" << st.elapsedMSec());

View file

@ -147,6 +147,8 @@ public:
/// output somewhere (a UI, presumably) /// output somewhere (a UI, presumably)
simgear::BufferedLogCallback* log() const simgear::BufferedLogCallback* log() const
{ return _log; } { return _log; }
static const char* subsystemName() { return "nasal"; }
private: private:
//friend class FGNasalScript; //friend class FGNasalScript;
friend class FGNasalListener; friend class FGNasalListener;