More safe subsystem accessors.
This commit is contained in:
parent
52b91d4863
commit
2ff476a217
4 changed files with 5 additions and 3 deletions
|
@ -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,
|
||||
|
|
|
@ -171,6 +171,7 @@ public:
|
|||
|
||||
virtual puFont *getDefaultFont() { return _font; }
|
||||
|
||||
static const char* subsystemName() { return "gui"; }
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue