]> git.mxchange.org Git - flightgear.git/commitdiff
Make use of view[0] in HUD-runway lazy.
authorJames Turner <zakalawe@mac.com>
Thu, 28 Oct 2010 12:54:01 +0000 (13:54 +0100)
committerJames Turner <zakalawe@mac.com>
Thu, 28 Oct 2010 12:54:01 +0000 (13:54 +0100)
src/Instrumentation/HUD/HUD.hxx
src/Instrumentation/HUD/HUD_runway.cxx

index 3ef9d7ee7d8fbbafa59ed14657f54b04d2017b8f..3408e54c58e55e8e58cf2620ed4c489e4b054eb4 100644 (file)
@@ -599,7 +599,6 @@ private:
     double _default_heading;
     GLint  _view[4];
     FGRunway* _runway;
-    FGViewer* _cockpit_view;
     unsigned short _stipple_out;    // stipple pattern of the outline of the runway
     unsigned short _stipple_center; // stipple pattern of the center line of the runway
     bool   _draw_arrow;             // draw arrow when runway is not visible in HUD
index fcf4f11277c0da885f716419582feb96ef3388df..ae6ebba65a8cd20b230d2a1ee9b1659588065ac0 100644 (file)
@@ -49,7 +49,6 @@ HUD::Runway::Runway(HUD *hud, const SGPropertyNode *node, float x, float y) :
     _scale_dist(node->getDoubleValue("scale-dist-nm")),
     _default_pitch(fgGetDouble("/sim/view[0]/config/pitch-pitch-deg", 0.0)),
     _default_heading(fgGetDouble("/sim/view[0]/config/pitch-heading-deg", 0.0)),
-    _cockpit_view(globals->get_viewmgr()->get_view(0)),
     _stipple_out(node->getIntValue("outer_stipple", 0xFFFF)),
     _stipple_center(node->getIntValue("center-stipple", 0xFFFF)),
     _draw_arrow(_arrow_scale > 0 ? true : false),
@@ -69,7 +68,6 @@ HUD::Runway::Runway(HUD *hud, const SGPropertyNode *node, float x, float y) :
     _top = _center_y + (_h / 2) + _y;
 }
 
-
 void HUD::Runway::draw()
 {
     _runway = get_active_runway();
@@ -87,8 +85,10 @@ void HUD::Runway::draw()
     double po = curr_view->getPitchOffset_deg();
     double ho = curr_view->getHeadingOffset_deg();
 
-    double yaw = -(_cockpit_view->getHeadingOffset_deg() - _default_heading) * SG_DEGREES_TO_RADIANS;
-    double pitch = (_cockpit_view->getPitchOffset_deg() - _default_pitch) * SG_DEGREES_TO_RADIANS;
+    FGViewer* cockpitView = globals->get_viewmgr()->get_view(0);
+    
+    double yaw = -(cockpitView->getHeadingOffset_deg() - _default_heading) * SG_DEGREES_TO_RADIANS;
+    double pitch = (cockpitView->getPitchOffset_deg() - _default_pitch) * SG_DEGREES_TO_RADIANS;
     //double roll = fgGetDouble("/sim/view[0]/config/roll-offset-deg",0.0) //TODO: adjust for default roll offset
     double sPitch = sin(pitch), cPitch = cos(pitch),
            sYaw = sin(yaw), cYaw = cos(yaw);