- Add an optional argument to flightgear::initApp(): doInitQSettings.
This argument defaults to true, preserving initApp()'s behavior in
this respect. If this argument is set to false, FGGlobals doesn't have
to be initialized.
- New function flightgear::initQSettings(), called by
flightgear::initApp() when its 'doInitQSettings' argument is true.
This allows initializing the QSettings exactly when it is needed.
- New function flightgear::checkKeyboardModifiersForSettingFGRoot().
The code it contains used to be run from initApp(), which is
undesirable because:
1) initApp() is not only called at FG initialization (fgMainInit()),
but also from QtMessageBox(), from QtFileDialog::exec() and twice
from Options::setupRoot(). However, checking the Alt and Shift
modifiers to set 'fg-root' in QSettings to the special value
"!ask" only makes sense in fgMainInit(), not in these other
places.
2) This code relies on the QSettings to be set up, and therefore on
FGGlobals. Thus, freeing initApp() of its dependency on FGGlobals
requires splitting this keyboard modifiers checking code out of
initApp().
This is likely to fix the problem preventing startup on Windows when the
username contains non-ASCII characters (cf.
<https://forum.flightgear.org/viewtopic.php?f=22&t=31320>). Thanks to
Headhunter76 for the useful report and to wkitty42 for doing the liaison
officer. ;-)
I can't actually test this, because I don't have Windows. Windows users
should report whether this works for them.
If the response to the HTTP request isn't 200 (success), then don't save
the response, and don't call the callback.
Additionally, only retry in the case of HTTPException. This allows using
Ctrl-C to work correctly (and easily).
There is a Flightgear property called /sim/hitches/winch/automatic-release-angle-deg that can be used to simulate a safety feature built into modern gliders. If the cable angle gets too great during a winch launch, the hook will automatically release the cable. This usually happens when the glider gets almost on top of the winch at the top of the launch without releasing the cable.
Unfortunately winch launching has two separate implementations, one in Nasal for JSBSim, and another one in C++ for YASIM. The YASIM one does not implement this property so I wrote a patch to add this.
Previously timer objects defaulted to using wall-clock (real) dt which
does not reflect pause/speed-up. Keep this as the default for
compatibility but make it possible to request simulated time.
Special case handling when recently removed properties are re-added;
when this happens simply send a value change since it's much cheaper
over the wire and for the receiver. Poorly designed Canvas code does
this frequently (eg, every update)
- Handle file I/O and parsing errors. This allows current
<http://gateway.x-plane.com/navaids/LatestNavFix.zip> to be loaded
instead of failing in an endless loop.
Read the fields of a record with std::getline() followed by
simgear::strutils::split(), itself followed by calls to std::stoi(),
std::stof() and std::stod(). Stream extraction (>>) isn't very good
here, because it can read for instance an int *and* a float from the
string "3.14", i.e. extract 3 followed by 0.14 (thus falsifying the
number of fields found...).
Check the number of fields (not 100 % reliable since the last field,
the navaid name, typically contains spaces---but we can detect
some situations where the number of fields is definitely too low).
- Fix line numbering (sgstream.cxx's skipcomment() isn't fit for this
purpose, because it can gobble any number of lines without the line
number being increased).
- Don't use a hardcoded number of lines for the nav.dat loading
percentage indicator; rely on sg_gzifstream::approxOffset() instead.
- Make navDBInit() and loadCarrierNav() throw an sg_io_exception upon
I/O errors (not for parsing errors that only affect a record). They
don't return a bool anymore (which wasn't checked by their only
caller, anyway).
- Use the 'rowCode' variable name instead of 'rawType' for consistency
with the *.dat specs.
- Small change in tests: (elev_ft < 0.01) replaced with (elev_ft <= 0).
Doesn't change the behavior, since 'elev_ft' is an int. Can be
reverted if someone really prefers the float comparison, I don't mind
that much about it.
- Add missing headers and a few comments.
This commit does not change the contents added to the NavCache with
FlightGear's current $FG_ROOT/Navaids/nav.dat.gz, except for 4 bogus
navaids which are not added anymore (at LIBV, OPJA, RCFN and RCYU): see
<https://sourceforge.net/p/flightgear/mailman/message/35526617/>. They
are instead properly reported as coming from invalid nav.dat lines.
Since the Save function can be triggered from Nasal with an arbitrary
path, we must check this path before overwriting the file.
(also add a missing include that is directly needed for this commit)