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 )
return;
FGNasalSys *nas = dynamic_cast<FGNasalSys*>(globals->get_subsystem("nasal"));
FGNasalSys *nas = globals->get_subsystem<FGNasalSys>();
if( !nas )
SG_LOG( SG_GENERAL,
SG_ALERT,

View file

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

View file

@ -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<FGNasalSys>(SGSubsystemMgr::INIT);
nasal->init();
SG_LOG(SG_GENERAL, SG_INFO, "Nasal init took:" << st.elapsedMSec());

View file

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