avoids an exception throw when the controller fails to init, which
avoids us breaking the stack when called via setMode, etc. Showed
up as error reports on Sentry.
Make this exception inherit std::runtime_exception, so that it’s
caught by the ‘normal’ exception cases in FG boostrap.cxx
This is the only exception I can find in the codebase, which does not
inherit from either std::exception or std::string, so this is to fix
‘unknown exception’ errors reported in the wild.
Sentry-Id: FLIGHTGEAR-1C
It seems that some aircraft sometimes incorrectly pass view indices rather
than numbers resulting in out-of-range access to FGViewMgr::views[]; See
flightgear-devel thread with subject "View crash (after loading errors)".
With this commit, if we are given an incorrect view number, we output a
diagnostic with SG_ALERT, assert fail, and cope with the problem. Arguably we
could do something more serious such as opening a popup or throw an exception.
We now attach global event handler to extra view windows so key presses are
handled as normal.
And the main event handler for mouse movements now calls new SviewMouseMotion()
which pans/tilts extra view windows in response to right-button mouse-drag.
Check for NaNs after each FDM iteration, and freeze the sim if found.
Report this condition to the user and to the reporting backend, along
with the last valid position.
Probably needs some refinement, this is just a first guess.
Sentry-Id: FLIGHTGEAR-AM
When in LEG mode, and within the intercept cone, but further away from
the leg waypoint than the leg origin, we were computing a bogus
abeam point and hence a bogus desired track.
Detect this situation, and invert the computed along-track-distance,
so the computed abeam point is actually near where we are, and not ahead
of us.
- exclude POIs and some other types from the ident match, to avoid
confusing results
- improve how the search vicinity is computed when inserting a leg,
which is the common case for a route with a destination set. Use
the midpoint of the leg ending at the insert position, as the optimal
search vicinity
- move the waypointFromString code into route.cxx, since it is mostly
independent of a FlightPlan instance
- extend the tests to cover the bug which flagged these issues
Ticket-Id: https://sourceforge.net/p/flightgear/codetickets/2372/
Prevent errors from property code when leading / trailing whitespace
occurs in the autopilot XML, in a property path. Use strutils::strip
to remove whitespace.
Ticket-Id: https://sourceforge.net/p/flightgear/codetickets/2445/
SviewCreate() now takes a SGPropertyNode* config which contains all information
needed to specify the view, including window size and position.
By default views are defined using a series of <step>...</step> nodes which map
to SviewStep* classes internally.
Alternatively, existing extra-view functionality is supported using
type='current', 'last_pair' or 'last_pair_double', plus one can use old-style
<view>...<view> nodes with type='legacy'.
See src/Viewer/sview.hxx for details and examples.
The extra-view commands view-clone, view-last-pair and view-last-pair-double
now pass the supplied SGPropertyNode* through the underlying FGViewMgr to
SviewCreate().
Improved handling of +/- heading and pitch values. For example some legacy
views have inverse relationship between heading-offset-deg and the actual
heading offset, so we now only multiply by -1 early on when handling these
legacy views, and SviewStepRotate does not negate.
Fixed Helicopter view direction bug with multiplayer aircraft - need to use
global /sim/current-view/heading-offset-deg, even for multiplayer aircraft.
Fixed incorrect handling of roll in pilot view - when adding in extra changes
of heading, pitch and roll to things like Helicopter view, simply adding to
heading, pitch and roll doesn't work if aircraft roll is not zero. Instead we
need to do the calculation with SGQuatd, so have added optional rotation params
to SviewStepFinal.
Added support for legacy Tower view look from.
Details:
src/Main/fg_commands.cxx
src/Viewer/viewmgr.cxx
src/Viewer/viewmgr.hxx
Added 'view-new' command.
All recently-added view commands now pass the SGPropertyNode* arg to
globals->get_viewmgr() and from there to SviewCreate().
src/Viewer/sview.cxx
src/Viewer/sview.hxx
SviewStepAircraft and SviewStepNearestTower uses new Callsign
class for tracking multiplayer aircraft by callsign instead of
/ai/models/multiplayer[] number, so we cope when multiplayer aircraft
are renumbered by network outages.
Double views are now implemented as a final view step, instead of
in a separate class derived from SviewView. So all views are
implemented using SviewViewEyeTarget, and there is arguably no
need for the separate SviewView base class.
SviewViewEyeTarget now has a single list of steps, instead of separate
lists for eye and target, because the use of SviewStepCopyToTarget makes
separate lists unnecessary.