From: Torsten Dreyer Date: Sat, 20 Aug 2011 06:54:47 +0000 (+0200) Subject: new global function for aircraft position X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3fbbe3134a71c4072a54ed3a0d098912cc5f0cef;p=flightgear.git new global function for aircraft position add a new function to get the aircraft's position instead of reading /position/* properties --- 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)