1
0
Fork 0
Commit graph

12770 commits

Author SHA1 Message Date
James Turner
4fb5bc8512 Property-Mirror websocket: fix removing props.
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)
2016-12-10 22:01:25 +00:00
Florent Rougon
a3560adc03 nav.dat parser: small changes
- Try to make log messages less cryptic.
- Lower the level of two of them to SG_INFO, as discussed on the mailing
  list (<https://sourceforge.net/p/flightgear/mailman/message/35537475/>).
- Add a const qualifier.
2016-12-10 09:45:51 +01:00
Florent Rougon
a2bf424118 Improve parsing of nav.dat and carrier_nav.dat
- 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.
2016-12-10 01:02:30 +01:00
Florent Rougon
280cd52368 Security fix: don't allow the route manager to overwrite any file
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)
2016-12-09 17:15:06 +01:00
James Turner
9aaff777d9 Support CrashRpt 1403 2016-12-09 14:39:25 +00:00
Erik Hofman
709936a265 MSVC fixes 2016-12-08 01:03:26 +01:00
Erik Hofman
7ec7a8b60c Add the first version of AISim but 2016-12-07 11:05:07 +01:00
Erik Hofman
7ed4a5162e Replace auto_ptr with unique_ptr 2016-12-07 11:03:54 +01:00
James Turner
b767a33f84 MirrorPropertyTree websocket fixes
- deal with ‘NONE’ properties correctly
- use a better method to send the initial tree on connection.
2016-12-05 21:27:38 +00:00
James Turner
d9cd65305a Merge /u/saiarcot895/flightgear/ branch fix-stgmerge-c11 into next
https://sourceforge.net/p/flightgear/flightgear/merge-requests/60/
2016-12-04 11:50:17 +00:00
Torsten Dreyer
c3c0d25fe7 Fix Linux build 2016-12-03 22:46:31 +01:00
Saikrishna Arcot
c505fbad5c
Fix compiling stgmerge.cxx in C++11 mode. 2016-12-03 08:13:39 -08:00
James Turner
47042b03f4 Expose an entire property tree via WebSockets.
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!
2016-12-03 14:23:48 +00:00
James Turner
54aec82c38 Search packages using the matches API 2016-11-30 21:33:16 +00:00
James Turner
1c4e3263f8 Multiple Flight-Plan clears are a no-op 2016-11-30 12:16:23 +00:00
James Turner
df2ab15e6c Quiet Canvas font-loading. 2016-11-30 12:15:54 +00:00
James Turner
825c8c2006 Nicer rendering of aircraft ratings. 2016-11-29 15:45:17 +00:00
Florent Rougon
80bf762556 Replace C++-version-dependent conditional code with the C++11 variant only 2016-11-29 16:35:31 +01:00
James Turner
53d50d9ba0 Tweak painting of aircraft ratings in launcher.
Should ensure the full text is visible with a wider range of font sizes.
2016-11-28 18:17:25 +00:00
James Turner
831053bd04 Fixes for HUD, model-manager listeners.
Make the HUD listener recursive (its tree is quite shallow) and 
manually watch the children of /models/model[n] nodes when they
are added.
2016-11-27 14:49:28 +00:00
James Turner
b0fcd78e9f Fix lazy-loaded thumbnail size for aircraft dirs. 2016-11-25 22:53:06 +00:00
James Turner
5db1f5cad6 Per variant authors/description data.
Will only work once the catalogs(s) are updated, and needs a
corresponding SimGear update.
2016-11-25 22:45:48 +00:00
James Turner
14942f4e8b Move Yasim properties to /fdm/yasim
As discussed on the mailing list, make this more consistent with JSBsim.
We could still define common locations for these values as well, but
waiting on positive answer to that discussion on the ML.
2016-11-25 17:41:05 +00:00
Torsten Dreyer
7f3fa4a3b7 Set fallback (hardcoded) startup airport to LSZH 2016-11-22 09:27:30 +01:00
James Turner
ee1a042847 respect servers online flag. 2016-11-21 22:01:06 +00:00
James Turner
e64a2db5a0 Remove the scenery path mangling.
Requires a matching SG commit for correct operation.
2016-11-20 22:42:48 +00:00
James Turner
780e0f5a02 Restore active aircraft variant also. 2016-11-20 22:42:48 +00:00
James Turner
4db129cb01 Guard against a null result from HID code.
It seems strange that CFGetTypeID on null would crash, but the reports
from users suggest this might be the case.
2016-11-20 22:42:48 +00:00
Durk Talsma
b0d707c3f4 Merge branch 'next' of ssh://git.code.sf.net/p/flightgear/flightgear into next 2016-11-20 12:54:56 +01:00
Durk Talsma
f7424271a7 Some prepratory work for FGTraffic 2020: Added utils/traffic, a sample C++ source/header file, and the necessary changes in the CMakefile system to allow automatic compilation. 2016-11-20 12:52:21 +01:00
Torsten Dreyer
c4ea89dc97 Revert "temporarily add some noisy debug messages"
This reverts commit f538a6e1a1.
2016-11-20 11:39:46 +01:00
Torsten Dreyer
f538a6e1a1 temporarily add some noisy debug messages 2016-11-19 18:26:06 +01:00
James Turner
9bf337148d Expose c-of-g to property tree in YASim.
Patch by Henning Stalkhe
2016-11-18 16:40:38 +01:00
James Turner
1a6263f22a Don’t greedy load on-disk aircraft thumbnails.
Should make switching to the aircraft launcher tab more responsive when
using larger aircraft directories, such as a complete FGaddon checkout.
2016-11-18 16:39:00 +01:00
Torsten Dreyer
b652758330 Merge branch 'topics/mpdiscovery-via-dns' into next 2016-11-17 14:45:40 +01:00
Automatic Release Builder
8374744e85 new version: 2017.1.0 2016-11-17 13:43:31 +01:00
Automatic Release Builder
bcb44d1e5d new version: 2016.4.1 2016-11-17 13:43:31 +01:00
James Turner
ad17df3e1b Refactor launcher delegate state tracking.
Instead of the two vectors we manually composed, used a single unified
vector of structs to store delegate information in the model. This
simplifies the logic for tracking the active variant (and in the future,
thumbnail).
2016-11-16 22:37:44 +01:00
James Turner
5d7b65477f Simplify MSVC detection to match SimGear. 2016-11-15 00:07:32 +01:00
Torsten Dreyer
994ea1674b replace many auto_ptr by unique_ptr 2016-11-14 22:20:46 +01:00
Torsten Dreyer
09949ff3e3 Some logging cleanup and ignore SRV records with port #0 2016-11-14 21:57:50 +01:00
James Turner
a3c4b2d953 Better searching for aircraft in the launcher.
Search more fields from the package.
2016-11-13 22:51:35 +01:00
James Turner
eaf779deb2 Use ground-network to improve MP start location.
Search for the closest ground-net node near but /not/ on, the requested
runway. This works fairly well, although for some airports the selected
node is surprisingly far from the runway.
2016-11-13 22:20:40 +01:00
James Turner
1c4656512a Enforce separation of ground-net and dynamics.
This ensures ground-network is retrieved through the airport only, and
hence can be done safely early in init, when ATC/AI/dynamics don’t
exist yet.
2016-11-13 14:05:20 +00:00
Florent Rougon
a6f1c93a2b Use semantic versioning for the --json-report format version
The report now looks like:

{
        "meta": {
                "type": "FlightGear JSON report",
                "format major version": 1,
                "format minor version": 0
        },

        ...

}

When making compatible changes to the format (e.g., adding members to
JSON objects), only the minor version number should be increased.
Increase the major version number when a change is backward-incompatible
(such as the removal, renaming or semantic change of a member). Of
course, incompatible changes (like this one) should only be considered
as a last recourse.
2016-11-12 11:11:03 +01:00
Torsten Dreyer
979010de4d Initial commit of mpserver discovery via DNS 2016-11-10 11:14:49 +01:00
Florent Rougon
fb10f76e59 Add command-line option --json-report
- New methods Options::printJSONReport() and utility method
  Options::OptionsPrivate::createJSONArrayFromPathList().

- Small addition to Options::processOptions(), since the --json-report
  option must be processed *after* the TerraSync and download dirs, as
  well as aircraft and scenery paths, have been finally set.
2016-11-09 12:05:03 +01:00
Florent Rougon
b1b7f07edb Add FGGlobals::autosaveFilePath(); improve code related to {load,save}UserSettings()
Apart from providing a public method giving a path to the autosave file,
the main idea of this commit is to reduce redundancy where
globals->get_fg_home() was so far used in every place where the autosave
file is needed or saved. Use an optional argument for
FGGlobals::loadUserSettings() and FGGlobals::saveUserSettings()[1],
since it should be exceptional to access an autosave file in another
location than $FG_HOME.

Also add comments explaining how to avoid security pitfalls with
saveUserSettings() (cf. discussion around
<https://sourceforge.net/p/flightgear/mailman/message/35461636/>).

[1] Argument *added* to this method, for consistency with
    FGGlobals::loadUserSettings().
2016-11-09 11:46:39 +01:00
Florent Rougon
1b0a76943f Add public method to get the list of apt.dat files used by the NavCache
- The 'DatFilesGroupInfo' struct and 'DatFileType' enum are now public
  members of 'NavDataCache'.

- New public method NavDataCache::getDatFilesInfo() returning the
  'DatFilesGroupInfo' struct for a given type of dat files. For
  instance, this allows one to retrieve the ordered list of apt.dat
  files the NavCache would use if it were rebuilt at that time, as well
  as their total size.
2016-11-09 11:35:26 +01:00
Florent Rougon
fc81258d13 Add FGGlobals::get/set_download_dir(), unify TerraSync and download dirs setup
Similar to the existing FGGlobals::get/set_terrasync_dir(), add
FGGlobals::get_download_dir() and FGGlobals::set_download_dir() methods,
and of course the corresponding FGGlobals::download_dir public member
variable. FGGlobals::set_download_dir() stores the realpath() of the
given directory, including into the /sim/paths/download-dir property,
which is marked as read-only just as /sim/terrasync/scenery-dir already
is.

Handle the setup of the TerraSync and download dirs all in the same
place (Options::processOptions()), since most of the work is already
done there. This allows one to get rid of fgOptTerrasyncDir() and
fgOptDownloadDir(), and to make it easier to see that
globals->set_terrasync_dir() (resp. globals->set_download_dir()) is
called on the correct SGPath, regardless of whether --terrasync-dir
(resp. --download-dir) was passed.

Always create the TerraSync and download dirs when they don't already
exist, regardless of whether --terrasync-dir or --download-dir has been
given on the command line.

Add comments explaining how to avoid security pitfalls with download and
TerraSync dirs (cf. discussion around
<https://sourceforge.net/p/flightgear/mailman/message/35461636/>).

Adjust indentation where it was too broken, hampering readbility.
2016-11-08 22:23:51 +01:00