]> git.mxchange.org Git - flightgear.git/blobdiff - src/Network/ray.cxx
Fix crashes (activating the route-manager) with a default GPS.
[flightgear.git] / src / Network / ray.cxx
index c4b0508ba157c9b524dd8093e385935584a1601b..b85831087d68c83e8998b0483de4dd71506fb89f 100644 (file)
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
 
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/io/iochannel.hxx>
 
-#include <FDM/flight.hxx>
+#include <FDM/flightProperties.hxx>
 
 #include "ray.hxx"
 
@@ -63,7 +66,8 @@ FGRAY::~FGRAY() {
 
 bool FGRAY::gen_message() {
     // cout << "generating RayWoodworth message" << endl;
-    FGInterface *f = cur_fdm_state;
+    FlightProperties f;
+    
     int axis, subaxis;
     const double fullscale[6] = { -0.5, -0.5, -0.5, /* radians */
                                  -0.3, -0.3, -0.15  /* meters */ };
@@ -73,7 +77,7 @@ bool FGRAY::gen_message() {
 
     /* get basic information about gravity */
     double grav_acc = -9.81;
-    double vert_acc = f->get_A_Z_pilot() * 0.3;
+    double vert_acc = f.get_A_Z_pilot() * 0.3;
     if ( -3.0 < vert_acc )
        vert_acc = -3.0;
 
@@ -86,13 +90,13 @@ bool FGRAY::gen_message() {
 
        /* Retrieve the desired components */
        switch ( axis ) {
-       case 0: ang_pos = f->get_Phi();
-               lin_acc = f->get_A_Y_pilot() * 0.3;
+       case 0: ang_pos = f.get_Phi();
+               lin_acc = f.get_A_Y_pilot() * 0.3;
                break;
-       case 1: ang_pos = f->get_Theta();
-               lin_acc = f->get_A_X_pilot() * 0.3;
+       case 1: ang_pos = f.get_Theta();
+               lin_acc = f.get_A_X_pilot() * 0.3;
                break;
-       case 2: ang_pos = f->get_Psi();
+       case 2: ang_pos = f.get_Psi();
                lin_acc = grav_acc - vert_acc;
                break;
        default: