1
0
Fork 0
Commit graph

12829 commits

Author SHA1 Message Date
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
Florent Rougon
bbf5ac6406 Fix the --version option
1) Paths and the FG_SCENERY paths list are now printed like:

     FG_ROOT=/home/flo/flightgear/src/fgdata

   instead of:

     FG_ROOT=Path "/home/flo/flightgear/src/fgdata"

   Moreover, FG_SCENERY is now correctly printed (without 'Path ""'
   wrapping, without Terrain, Objects and markers instead of the actual
   scenery paths) regardless of the position of --version relatively to
   --fg-scenery, --terrasync-dir, etc. Of course, the values given to
   these options do influence the output of --version.

   Simplify printing of FG_SCENERY via SGPath::join() and use the
   correct, OS-dependent separator between paths, SGPath::pathListSep.

   Write the --version output to stdout, as already done for --help;
   then it can be easily piped to $PAGER and doesn't get mixed with the
   output of SG_LOG (which is on stderr). This is of course backward
   incompatible for programs reading the stderr output of
   'fgfs --version', but has been agreed upon on FlightGear-devel (cf.
   <https://sourceforge.net/p/flightgear/mailman/message/35461619/>).

2) Don't write explicit values in the OptionResult enum: they don't
   matter, but giving them is error-prone in case one does a copy-paste
   to add a new member to the enum and forgets to change the value.
2016-11-08 22:23:51 +01:00
Florent Rougon
c7c66d7a3b Fix handling of -- (end-of-options delimiter on the command line) 2016-11-08 22:23:51 +01:00
Florent Rougon
c169ef581f Remove ambiguity due to simgear/misc/sgstream.cxx's skipws I/O manipulator
For some reason, g++ may see a 'skipws' I/O manipulator from the
standard library (depending on the order of includes...) when compiling
src/Navaids/poidb.cxx. This I/O manipulator is then in competition with
one with the same name defined in simgear/misc/sgstream.cxx. Use std::ws
to remove all ambiguity (std:skipws does something quite different!).
2016-11-08 22:23:51 +01:00
Stuart Buchanan
55f64820df Fix display of OBJECT_BUILDING_MESH_DETAILED 2016-11-08 19:43:32 +00:00
Edward d'Auvergne
74622d9a04 Time: Calculation and exposure of the moon vector from the local position.
The new FGLight::updateObjects() function is now being passed into the global
events manager as a task rather than FGLight::updateSunPos().  The
updateSunPos() function has been renamed to updateBodyPos() and generalised for
any solar system body and is called twice by updateObjects(), once for the sun
and once for the moon.  The local position of the moon is then exposed at
"/ephemeris/moon/local/".
2016-11-08 11:16:24 +01:00
Edward d'Auvergne
b574728411 Ephemeris: Exposure of the moon's absolute attributes in the property tree.
This includes the moon's absolute position, age and phase.  For this, the new
simgear MoonPos::get*() functions are tied to the property tree at
"/ephemeris/moon/" using a new tieMoonPos() function.

In addition the moon illumination factor is exposed by tying the simgear
MoonPos::getIlluminanceFactor() function to the /environment/moonlight property.
This is a number ranging between 0 and 1 based on the log of the illuminance of
the moon outside the atmosphere.  It is calculated as

    factor = (log(I) - max_loglux) / (max_loglux - min_loglux) + 1.0,

The illuminance of the moon outside the atmosphere, I, is from equation 20 from:

   Krisciunas K. and Schaefer B.E. (1991). A model of the brightness of
moonlight, Publ. Astron.  Soc. Pacif. 103(667), 1033-1039 (DOI:
http://dx.doi.org/10.1086/132921).

For more background, see
http://forum.flightgear.org/viewtopic.php?f=47&t=28201&start=60#p270516 .
2016-11-08 11:16:24 +01:00
Edward d'Auvergne
6e62228c1d Time: The sun solver has been generalised to to handle any solar system body.
The functions fgSunPositionGST() and fgTimeSecondsUntilSunAngle() have been
renamed to fgBodyPositionGST() and fgBodyPositionGST() respectively, and both
require a new char argument specifying the body of interest.  This allows the
position of all solar system bodies to be calculated from the aircraft frame of
reference.
2016-11-08 11:16:24 +01:00
Edward d'Auvergne
0ba2e8708e Time: Renamed the sunsolver.cxx to bodysolver.cxx.
This is in preparation for generalising the code for handling all solar system bodies.
2016-11-08 11:16:24 +01:00
Torsten Dreyer
af8625e4ac fgelev: add option to print solidness of terrain
Add option --print-solidness
without this option, behaviour of fgelev is unchanged
with this option the word "solid" gets printed behind the elevation if the
material at the given location is solid. A hyphen (-) gets printed otherwise
2016-11-08 10:42:48 +01:00
James Turner
5fe4486df1 Add ‘nearest node not on a runway’ to ground-net
This will be used shortly to find a better (not on the grass, ideally)
start position when using multi-player but requesting a runway start.
2016-11-08 09:27:52 +01:00
James Turner
e523b57215 Fix Windows compilation hopefully. 2016-11-08 09:26:54 +01:00
James Turner
e1cf3423a5 ‘Update all aircraft’ UI overlay.
WIP, but basics should be there.
2016-11-07 20:49:33 +01:00
James Turner
793c78512e Prettier terrasync progress on splash screen. 2016-11-07 15:29:17 +01:00
James Turner
4d8c04bc58 Tweak launcher summary page.
Include the aircraft description, and move the thumbnail to give
more room for displaying text.
2016-11-07 15:14:41 +01:00
James Turner
f12de69056 Add MP status to launcher summary. 2016-11-07 13:00:57 +01:00
James Turner
a46c7ca8e4 Launcher has history for locations and aircraft.
Move the existing aircraft history to a more obvious place, and follow
the same pattern for the complete location history. This makes restoring
a previously used configuration much simpler.
2016-11-07 12:54:38 +01:00
James Turner
90f4214afa Launcher fix handling of default MP port.
Without this, a default port for a custom server does not get set
correctly.
2016-11-06 21:51:15 +01:00
James Turner
18b8a76262 Launcher uninstall button for aircraft. 2016-11-06 21:50:34 +01:00
James Turner
f68987e896 Quiet some log output. 2016-11-06 21:49:47 +01:00
James Turner
7b0c58081b JSBsim lib needs SimGear headers. 2016-11-03 10:01:27 +00:00
James Turner
4c462872ff Launcher lib uses SimGear
Need this so package headers are available when compiling the launcher
classes.
2016-11-03 09:56:48 +00:00
James Turner
6382d20f68 Fix flightProperties build. 2016-11-02 14:39:53 +00:00
Erik Hofman
4ee8661eaa Include the cmath header 2016-11-02 15:30:35 +01:00
James Turner
e2f7585d9c Use a Cmake imported target for SimGear 2016-10-30 22:15:54 +00:00
Rebecca N. Palmer
06b6c4f513 Nasal security: allow reading more directories
--aircraft-dir, and --download-dir / Aircraft,AI,Liveries (see
https://sourceforge.net/p/flightgear/mailman/message/35417419/
for why not all --download-dir)
2016-10-30 21:06:08 +00:00
Rebecca N. Palmer
194a6f8974 options: use fromLocal8Bit for --download-dir and --aircraft-dir 2016-10-29 16:31:08 +01:00
James Turner
94d96c56cd Replace one more use of isnan() 2016-10-26 14:12:26 +02:00
Torsten Dreyer
65b51b8d91 Limit the update rate of the property change websocket
Of fast systems with 60fps sending many properties to web clients
may overrun the rendering capabilities of the browser. At some point
the web socket client halts the simulation by throtteling the network
connection.

Update rate is settable at startup setting to a double value
/sim/http/property-websocket/update-interval-secs
(default: 0.05 aka 20Hz)
2016-10-26 11:02:24 +02:00
James Turner
8e451a05f1 Use Cmake 3.0, and enable C++11 support. 2016-10-24 22:53:55 +02:00
James Turner
c628ac7649 Use SGMisc::isNaN instead of isnan()
Fixes a compiler error with C++11/GGC 6.2
2016-10-24 18:40:36 +02:00
James Turner
1286e4157b Save / restore launcher window geometry. 2016-10-24 12:27:49 +01:00
James Turner
0878a1fba8 Launcher: remove spacer above ‘additional options’. 2016-10-24 12:25:12 +01:00
James Turner
ac33092032 Fix crash disabling AI traffic at runtime.
https://sourceforge.net/p/flightgear/codetickets/1848/
2016-10-20 22:52:27 +01:00
James Turner
ad43d52070 Fix message-box crash in non-Qt builds.
Only affects Linux where we have no fallback UI option.

https://sourceforge.net/p/flightgear/codetickets/1900/
2016-10-20 20:27:47 +01:00
James Turner
ce79be323a Fix command line doc URL.
https://sourceforge.net/p/flightgear/codetickets/1906/
2016-10-20 20:27:47 +01:00
Florent Rougon
f4e0bf05f5 Make sure we open exactly the desired file when loading apt.dat files
Without this change, it would be possible that the NavCache is rebuilt
using $FG_ROOT/Airports/apt.dat (if $FG_ROOT/Airports/apt.dat.gz is
manually deleted) despite APTLoader::readAptDatFile() using
sg_gzifstream() with $FG_ROOT/Airports/apt.dat.gz, but the NavCache
would still contain a reference to $FG_ROOT/Airports/apt.dat.gz and log
messages would pretend we are reading this (non-existent) file.

Unrelated: the change

-          "Loaded data for " << nbAirports << " airports" );
+          "Loaded data for " << nbLoadedAirports << " airports" );

has no incidence given the current code, but it is more logical and
future-proof (in case someone adds a continue statement inside the for
loop starting at line 224...).
2016-10-20 16:55:36 +02:00
James Turner
23cc1974d7 Fix crash with multiple windows on Sierra. 2016-10-20 10:44:32 +01:00
Florent Rougon
101bdce343 APTLoader: improve progress status info
It is not needed anymore to hardcode the number of lines of
$FG_ROOT/Airports/apt.dat.gz. The new method, which relies on
SGPath::sizeInBytes() and sg_gzifstream::approxOffset(), works as well
for the other dat files.

Add a new NavCache rebuild phase, REBUILD_READING_APT_DAT_FILES, since
the process is now made of two parts.

Rename NavDataCachePrivate::getDatFilesPaths() to
NavDataCachePrivate::findDatFiles(), because it now returns a
DatFilesGroupInfo (new struct) instead of a PathList. For the same
reason, rename NavDataCachePrivate::aptDatPaths to
NavDataCachePrivate::aptDatFilesInfo. Adapt signatures, etc.

This requires up-to-date SimGear and FGData.
2016-10-19 13:01:35 +02:00
Rebecca N. Palmer
0ec47c9802 Simplify Nasal security code 2016-10-18 23:01:24 +01:00
Rebecca N. Palmer
0a256038d3 Remove set-scenery-paths, make all scenery paths Nasal-readable
(It was probably broken anyway, due to path caching in tilemgr.cxx)
2016-10-18 22:29:44 +01:00
Rebecca N. Palmer
9f6ce5625c remove now-redundant warning 2016-10-18 22:17:34 +01:00