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)
Use a recursive listener to expose a property tree via a WebSocket.
Currently using a JSON-based encoding, will likely change to binary so
please don’t write code using this interface until the encoding
is stable and documented!