1
0
Fork 0

src/Viewer/view.cxx: View::recalcLookAt(): Use new view[]/config/eye-fixed tag.

We only look at config/eye-lon-deg-path etc if eye-fixed is true. This tag
should be set to true for all views where the eye position is fixed - e.g. all
Tower views plus Fly-By view in fgdata:defaults.xml.

This allows b26 turret views to work without requiring modifications to the
aircraft (which would break usage with older releases of fgfs).
This commit is contained in:
Julian Smith 2020-03-01 18:14:12 +00:00
parent 368443a4b3
commit 25a64b2cba

View file

@ -1001,16 +1001,8 @@ View::recalcLookAt ()
_position = _target;
const std::string& tail = ViewPropertyEvaluator::getStringValue("(/sim/view[(/sim/current-view/view-number-raw)]/config/eye-lon-deg-path)");
if (tail != "") {
/* <tail> will typically be /sim/tower/longitude-deg, so that this view's
eye position is from the tower rather than relative to the aircraft.
If we are viewing a multiplayer aircraft, the nearest tower
will be in /sim/view[]/config/root/sim/tower/longitude-deg (see
FGEnvironmentMgr::updateClosestAirport()), so we use a prefix to select
either /sim/tower/longitude-deg or multiplayer's tower. */
bool eye_fixed = ViewPropertyEvaluator::getBoolValue("(/sim/view[(/sim/current-view/view-number-raw)]/config/eye-fixed)");
if (eye_fixed) {
_position.setLongitudeDeg(
ViewPropertyEvaluator::getDoubleValue(
"((/sim/view[(/sim/current-view/view-number-raw)]/config/root)(/sim/view[(/sim/current-view/view-number-raw)]/config/eye-lon-deg-path))",