diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index 99f1709da..40afef14c 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -362,6 +363,18 @@ FGGlobals::get_event_mgr () const return event_mgr; } +const SGGeod & +FGGlobals::get_aircraft_position() const +{ + if( acmodel != NULL ) { + SGModelPlacement * mp = acmodel->get3DModel(); + if( mp != NULL ) + return mp->getPosition(); + } + throw sg_exception("Can't get aircraft position", "FGGlobals::get_aircraft_position()" ); +} + + // Save the current state as the initial state. void diff --git a/src/Main/globals.hxx b/src/Main/globals.hxx index e241b6297..d2027d333 100644 --- a/src/Main/globals.hxx +++ b/src/Main/globals.hxx @@ -265,6 +265,8 @@ public: acmodel = model; } + const SGGeod & get_aircraft_position() const; + inline FGModelMgr *get_model_mgr () { return model_mgr; } inline void set_model_mgr (FGModelMgr * mgr)