1
0
Fork 0
Commit graph

9771 commits

Author SHA1 Message Date
James Turner
206b272210 Add additional nameForType aliases 2017-01-03 15:16:23 +00:00
James Turner
f062fd0f60 Fix missing FGPositioned nameForType data. 2017-01-03 15:14:26 +00:00
James Turner
8aec4a0cef Silence a clang warning. 2017-01-03 15:11:12 +00:00
Florent Rougon
16fdfac7ae QtFileDialog: allow showing hidden files 2016-12-30 02:12:59 +01:00
Florent Rougon
f4d8d8c6a1 Minor changes
Essentially, adapt two places where options.xml was supposed to be found
in $FG_ROOT (in one of these, the comment was already incorrect way
before the recent change moving options.xml out of FGData).
2016-12-29 14:01:56 +01:00
Florent Rougon
7288628919 Load --help output and translated strings from $FG_INSTALL_PREFIX/share/flightgear
$FG_INSTALL_PREFIX represents the FlightGear installation prefix, such
as /usr, /usr/local or /opt/FlightGear on Unix systems. Copying the
--help output and translated strings there avoids having to write to
$FG_ROOT when 'make install' (or some OS-dependent equivalent) is run
from the FlightGear build directory---that would be ugly when $FG_ROOT
points to the FGData Git repository.

In FGLocale::FGLocale(), Translations/locale.xml is loaded using
readProperties() and fatalMessageBox() (in case an error is
encountered). Note that it couldn't be loaded via fgLoadProps() in the
current state, because this function relies on guiErrorMessage() when an
error is encountered, which calls mkDialog(), which itself does
globals->get_subsystem("gui"). This last call can't be done from
FGGlobals' constructor---where the 'globals' pointer is still
NULL---hence the need for a different mechanism not relying on
FGGlobals.

For consistency, and also because it provides a better user experience[1],
load options.xml using the same method instead of with fgLoadProps().

[1] I.e., in case of an error, the user gets to see a graphical popup
    window with an explanatory message before FG exits, assuming he is
    either on Windows, or on Mac, or has Qt support built in FG, as
    opposed to only an SG_LOG() call [because when options.xml is
    loaded, guiErrorMessage() used by fgLoadProps() can't use the 'gui'
    subsystem].
2016-12-29 13:40:16 +01:00
Florent Rougon
a6afda53bb Split flightgear::initApp() to make it usable even without FGGlobals initialized
- 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().
2016-12-29 11:33:19 +01:00
Florent Rougon
0b1c356837 Make the FG installation prefix available to C++ code via config.h
CMAKE_INSTALL_PREFIX is now available as FG_INSTALL_PREFIX from
config.h.
2016-12-29 11:33:19 +01:00
Erik Hofman
2b9de5ceaa Make it possible to choose a different electrical circuit instead of the defaukt systems/electrical/outputs/turn-indicator by specifying the xml tag <electrical/> 2016-12-29 09:55:54 +01:00
James Turner
95e09de1ff Remove a log message. 2016-12-28 22:01:29 +01:00
Florent Rougon
d6313e52b5 Correctly initialize an SGPath from the APPDATA environment variable on Windows
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.
2016-12-28 16:57:26 +01:00
Erik Hofman
ffdfdcb6d7 Alter the sequence to allow type conversion 2016-12-23 16:01:49 +01:00
Erik Hofman
31ed6184a9 NExt batch of updates: more use of SIMD instructions. Still work in progress. 2016-12-22 15:14:52 +01:00
Erik Hofman
33f0b83b69 Viktor Radnai:
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.
2016-12-22 11:49:15 +01:00
James Turner
eba1f3221f Fix a bug starting the property-tree mirror. 2016-12-21 10:26:31 +00:00
James Turner
57432c20ad Remove some stale code. 2016-12-21 10:26:31 +00:00
Erik Hofman
342f75d48c Add a missing break statement 2016-12-21 09:50:53 +01:00
Torsten Dreyer
c472788ad8 Httpd: fix slow websocket init 2016-12-20 11:46:02 +01:00
James Turner
d831751b11 Fix aircraft-history naming of variants. 2016-12-18 21:25:05 +00:00
Erik Hofman
8b466cb207 One last(?) MSVC fix 2016-12-15 20:08:25 +01:00
Erik Hofman
e845dab6e0 Fix an MSVC error 2016-12-15 10:49:09 +01:00
James Turner
0af316d7fc Nasal Time objects can use simulated time.
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.
2016-12-11 16:10:57 +00:00
Florent Rougon
3dea0f73aa Use SGPath::fromUtf8() to construct an SGPath from a property node string value
This was missing in a few places of src/Autopilot/route_mgr.cxx.
2016-12-11 12:40:09 +01:00
James Turner
85f75dee4f Fix a couple of potential crashes on exit.
- Font cache shutdown explicitly
- Pending GUI snapshot cleared explicitly

Both of these are dependencies on the osgViewer / GLContext.
2016-12-10 23:24:09 +00:00
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
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
Torsten Dreyer
c3c0d25fe7 Fix Linux build 2016-12-03 22:46:31 +01: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
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
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
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
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
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
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
Rebecca N. Palmer
3b1f01c49d stop using /sim/terrasync/scenery-dir, fix scenery path order
Having non-Nasal-readable scenery paths breaks things
(The property continues to exist, but is now from-C++-to-Nasal only)
2016-10-18 22:10:09 +01:00
Florent Rougon
57402dec1b Fix a compilation bug that can appear before C++11
Initialization of std::vector can't be done simply in braces-style
(var = { ... }) before C++11.
2016-10-18 08:48:46 +02:00
Florent Rougon
f702f97220 APTLoader: better signatures, check array bounds, line numbers in error messages
Add checks to avoid read-past-vector-bounds errors.

Make the current line number in each apt.dat file available to methods
such as parseRunwayLine810(), parseRunwayLine850(), etc. for useful
error messages.

In APTLoader::parseCommLine():
  - use 'rowCode' instead of 'lineId' for consistency with the apt.dat
    spec and the rest of the code;
  - use 'unsigned int' for the type since row codes are always
    non-negative;
  - add a missing 'return' statement and improve an error message.

Small optimization in APTLoader::parseAirportLine().
2016-10-17 12:10:04 +01:00
Florent Rougon
72d0b516c8 APTLoader: rename member 'currentAirportID' to 'currentAirportPosID'
This will be clearer since it is a PositionedID and we are also dealing
with airport identifiers in the sense of the apt.dat spec in the same
class.

Rename 'line_id' to 'rowCode' in src/Airports/apt_loader.cxx

"Row code" is the expression consistently used for this number in the
apt.dat format spec. Since we already deal with airport *identifiers*,
this should make this piece of code easier to read.

For the same reason, rename the 'num' parameter of
APTLoader::parsePavementNodeLine850() to 'rowCode'.
2016-10-17 12:10:03 +01:00
Florent Rougon
da6d6eec5d APTLoader: move handling of Viewpoint lines to a separate method
- APTLoader::parseViewpointLine(): new method.
- APTLoader::parseViewpointLine(): check vector size to prevent
                                   past-bounds reading.

More accurate signature for fptypeFromRobinType()

Row codes in the apt.dat spec are always non-negative -> take an
unsigned int instead of just an int.

Use an initialization list for remaining members of APTLoader::APTLoader()

This is slightly more efficient in general. Swap the order of
declarations for the 'cache' and 'currentAirportID' members of
APTLoader to have the initialization list in the same order as the
member declarations (cf. g++'s -Wreorder option and
<http://stackoverflow.com/questions/1828037/whats-the-point-of-g-wreorder>).

Fix detection of blank lines by APTLoader::isBlankOrCommentLine()

In
<https://sourceforge.net/p/flightgear/flightgear/merge-requests/39/#cea6>,
it was decided to let the main apt.dat line reading loop give out
"lines" that may end with '\r', because most of the downstream code will
automatically get rid of this character thanks to its use of
simgear::strutils::split(). However, APTLoader::isBlankOrCommentLine()
didn't detect blank lines properly due to that trailing '\r', which
could cause bad behavior because the subsequent atoi() call could return
anything from a string containing only whitespace (the "anything" in
question being then interpreted as an apt.dat row code...).

Add method APTLoader::cleanLine()

This method returns a copy of the input line with trailing '\r' char(s)
removed.

APTLoader::loadAirports(): clean message when finding an unknown row code

The start of the log message could previously be overwritten by later
text because of the '\r' at the end of input lines (now obtained from
APTLoader::readAptDatFile()). Quite confusing! Use the new
APTLoader::cleanLine() to prevent this from happening.
2016-10-17 12:10:03 +01:00
Florent Rougon
9eb56fc9f1 Add tooltips in built-in launcher: remind to restart after changing scenery paths
Maybe this won't be necessary anymore in the future, but for now it is.
2016-10-17 12:10:03 +01:00
Florent Rougon
516a5cf016 Support merging of arbitrary apt.dat[.gz] files
It is now allowed to have the same airport appear in several apt.dat
files ($scenery_path/NavData/apt/*.dat[.gz] for each scenery path, plus
the default $FG_ROOT/Airports/apt.dat.gz, coming last). Airports found
in earlier files(*) take precedence over those found later, in case
several apt.dat files define the same airports. Airports that are
skipped due to this mechanism are logged with
SG_LOG(SG_GENERAL, SG_INFO, ...).

(*) using 1) FG_SCENERY order (followed by $FG_ROOT/Airports/apt.dat.gz)
    and   2) lexicographic order inside each $scenery_path/NavData/apt
             folder

With this commit, APTLoader::parseAPT() is replaced by two methods:
readAptDatFile() and loadAirports():
  - APTLoader::readAptDatFile() reads airport definitions from an
    apt.dat file into APTLoader's 'airportInfoMap' member variable,
    discarding duplicate definitions due to overlapping apt.dat files
    ('airportInfoMap' is an std::unordered_map instance in C++11 and
    later, an std::map otherwise);
  - APTLoader::loadAirports() reads each airport definition from
    'airportInfoMap' and loads it into the NavCache, the same way as
    APTLoader::parseAPT() used to do.

The airportDBLoad() function is not useful anymore, and is thus removed
(in NavDataCache::doRebuild(), APTLoader::readAptDatFile() is now called
once per apt.dat file, but APTLoader::loadAirports() is only called
once at the end, after duplicate airports have been discarded; the class
interface is much better suited to this scheme, because it can cleanly
retain the state between these calls).

By the way, this commit fixes an old bug: APTLoader's member variable
'last_apt_id' was used in several places but never assigned to, except
in APTLoader::APTLoader() as the empty string.

Thanks to Alan Teeder for his feedback and testing.
2016-10-17 12:10:03 +01:00
Florent Rougon
670cf9a894 Initial support for NavData/<type>/*.dat[.gz] files in scenery paths
Load every file matching the pattern NavData/apt/*.dat[.gz] inside each
scenery path. These files are loaded in the same order as the components
of globals->get_unmangled_fg_scenery() they reside in. Inside a given
component, the order is determined by pathSortPredicate() in
simgear/misc/sg_dir.cxx (lexicographic order at the time of this
writing). For compatibility with existing scenery,
$FG_ROOT/Airports/apt.dat.gz is also loaded last.

The idea is that such files will have the same precedence order as the
globals->get_unmangled_fg_scenery() scenery components they come from.
This commit doesn't handle this fully yet, though: it blindly loads all
these files. A future commit will ensure that no airport is loaded twice
due to overlapping apt.dat files. This commit however handles all the
logic of navdata cache rebuilding when the list, the order of apt.dat
files, or any of their timestamps changes.

Although only apt.dat files receive a new treatment in this commit, the
changes to NavDataCache.[ch]xx are already generic so that extension of
this method to fix.dat, nav.dat, etc. will require almost no change to
NavDataCache.[ch]xx (however, changes will probably be needed in the
various loaders: in fixlist.[ch]xx, navdb.[ch]xx, etc.).

src/Navaids/CacheSchema.h:

  - increment the SCHEMA_VERSION by 1. This ensures among others that if
    someone uses a FlightGear version posterior to this change with
    new-style scenery (having NavData/apt/*.dat[.gz] files inside
    scenery paths), then goes back to a FlightGear version anterior to
    this change, his NavCache is rebuilt ignoring the in-scenery-paths
    NavData/apt/*.dat[.gz] files, as expected with the old FlightGear
    version.

src/Navaids/NavDataCache.cxx:

  - NavDataCachePrivate: replace aptDatPath (SGPath) with aptDatPaths
    (PathList).

  - NavDataCachePrivate::getDatFilesPaths(): new method that returns the
    list of $scenery_path/NavData/<type>/*.dat[.gz] files found inside
    scenery paths (where <type> is one of 'apt', 'fix', etc.), plus the
    historical file (e.g., $FG_ROOT/Airports/apt.dat.gz for the 'apt'
    type).

  - NavDataCachePrivate::areDatFilesModified(): new method that tells
    whether any of these files (for a given type) has changed since the
    last NavCache rebuild, or if their ordered list has changed.

  - NavDataCachePrivate::isCachedFileModified(): minor changes.

  - NavDataCache::updateListsOfDatFiles(): new method that updates the
    lists of dat files used for NavCache freshness checking and
    rebuilding, i.e. currently sets/updates d->aptDatPaths using the new
    method d->getDatFilesPaths(), and d->metarDatPath, d->navDatPath,
    d->fixDatPath, d->poiDatPath, etc. as usual. This method will be
    useful for instance in the built-in launcher after updating scenery
    paths and before calling NavDataCache::isRebuildRequired().

  - NavDataCache::NavDataCache(): use
    NavDataCache::updateListsOfDatFiles() to initialize d->aptDatPaths,
    d->metarDatPath, d->navDatPath, d->fixDatPath, d->poiDatPath, etc.

  - NavDataCache::isRebuildRequired(): use
    NavDataCachePrivate::areDatFilesModified() instead of just checking
    $FG_ROOT/Airports/apt.dat.gz.

  - NavDataCache::doRebuild(): load all apt.dat files listed in
    d->aptDatPaths, instead of only $FG_ROOT/Airports/apt.dat.gz. Write
    their ordered list and timestamps in the NavCache.

src/Navaids/NavDataCache.hxx:

  - declare the new method NavDataCache::updateListsOfDatFiles().

  - NavDataCache::DatFileType: new enum with values DATFILETYPE_APT,
    DATFILETYPE_METAR, DATFILETYPE_AWY, DATFILETYPE_NAV,
    DATFILETYPE_FIX, DATFILETYPE_POI, DATFILETYPE_CARRIER and
    DATFILETYPE_TACAN_FREQ. Maybe some of the corresponding files won't
    have to be moved to scenery paths, but simply listing them in the
    enum doesn't change how they are dealt with. Those for which
    per-scenery-path locations doesn't make sense can just be removed
    from the enum.

  - NavDataCache::datTypeStr: new static string_list giving an
    std::string such as 'apt' for each value of the
    NavDataCache::DatFileType enum.

  - NavDataCache::defaultDatFile: new static string_list giving a path
    (relative to $FG_ROOT) to the historical/default file for each value
    of the NavDataCache::DatFileType enum.

src/Airports/apt_loader.cxx and src/Airports/apt_loader.hxx:

  - always include a path to the apt.dat file being processed in log
    messages, since they can now apply to many files;

  - be clearer about code 99: it should normally be at the end of
    apt.dat files, but technically, it is not an EOF;

  - use the expression "row code" consistently with the apt.dat format
    spec (for now: only in places where there is another change to do).

src/GUI/QtLauncher.cxx and src/GUI/QtLauncher_private.hxx:

  - turn QtLauncher::setSceneryPaths() into a static method and call it
    in runLauncherDialog() before instantiating NavDataCache, so that
    NavDataCache::updateListsOfDatFiles() (called from NavDataCache's
    constructor) can see all configured scenery paths.
2016-10-17 12:10:03 +01:00
Florent Rougon
dfdd52a81b Use SGPath::realpath() for paths stored in the stat_cache table of the NavCache
This will avoid problems in case stampCacheFile() or
isCachedFileModified() is passed a relative path, or a path containing
.. components, etc. Among others, it ensures the stat_cache table only
contains absolute paths.

NavDataCache: read and write methods preserving order for string list props

New methods: NavDataCache::readOrderedStringListProperty() and
NavDataCache::writeOrderedStringListProperty().
2016-10-17 12:10:03 +01:00
Florent Rougon
cb84219c34 APTLoader:
add missing includes; proper interface for the APTLoader class
remove unused members 'last_apt_info' and 'token'

The APTLoader methods defined in src/Airports/apt_loader.cxx are now at
top level instead of being inside a 'class' definition block, therefore
they don't have to be indented anymore.

APTLoader::throwExceptionIfStreamError(): better API and implementation
2016-10-17 12:09:28 +01:00
Rebecca N. Palmer
31cb65e8d9 Nasal security: add --allow-nasal-read, warn on non-Nasal-readable
Terrasync, prepare for allowing --download-dir

Add unmangled_fg_scenery
2016-10-09 15:21:09 +01:00
James Turner
c4f584dadf Rewrite Mac Event-Input code 2016-09-28 21:16:24 -05:00
James Turner
347a89c1f2 Extend event-input with report-setting.
Can generate feature report data via Nasal callbacks. This is used to
drive the GoFlight LCD / LEDs.
2016-09-28 21:16:24 -05:00
Florent Rougon
eb1c6adbc7 fix.dat parser: correct use of sg_io_exception
- For sg_io_exception's constructor, 'location' is not the same as
  'origin'.
- Use simgear::strutils::error_string() to provide details on the error.
2016-09-28 12:22:54 +02:00
Florent Rougon
29c7fa54b1 fix.dat parser: indentation fix 2016-09-28 12:22:54 +02:00
Florent Rougon
30c8328399 fix.dat parser: check the stream's badbit flag after each I/O operation
- new private method FixesLoader::throwExceptionIfStreamError();
- call it whenever appropriate.
2016-09-28 12:22:44 +02:00
Florent Rougon
d9c879ff30 fix.dat parser: new class FixesLoader; change loadFixes() into a method
- loadFixes() becomes FixesLoader::loadFixes();
- the previous 'cache' variable (NavDataCache *) is now a private member
  of FixesLoader, named '_cache'.
2016-09-28 09:24:33 +02:00
Florent Rougon
cf9759f78f fix.dat parser: fix line numbering and better handle malformed data
- Line numbering was incorrect, because "in >> lat >> lon >> ident;"
  happily skipped over blank lines without increasing the line number.

- Safe stream input handling: first, std::getline() tries to read data,
  then we check whether that was successful (via the input stream's
  bool() method, implicitly called in the 'for' loop's exit check), and
  only if this is the case, we process the data that was read. The main
  problem with the previous code is that checking the stream's eofbit
  can't possibly predict whether a _future_ read will be successful---it
  may fail due to an I/O error, at least.

- Currently, the code uses atof() to parse the latitude and longitude
  fields. This should be fast, though not good at detecting errors in
  the input; however, this is not worse than the previous code which
  didn't handle such cases at all.

- Correctly deal with input lines containing a number of fields
  different from 3 (except for the header and the special '99' line):
  log a warning, ignore the line and continue. This adresses the problem
  described in
  <https://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/87shydeen1.fsf%40frougon.crabdance.com/#msg35034274>.
  In short, the previous code entered an endless loop trying to process

   31.815914 -106.281897 EL PA

  from recent earth_fix.dat
  (obtained from <http://gateway.x-plane.com/navaids/LatestNavFix.zip>).
2016-09-28 09:24:33 +02:00
James Turner
ca70e64261 Request AMD PowerXpress. 2016-09-27 17:16:46 -05:00
James Turner
5bf9b3cd02 Remove the Ati viewport hack. 2016-09-27 17:16:34 -05:00
James Turner
2ff476a217 More safe subsystem accessors. 2016-09-27 05:58:47 -05:00
James Turner
52b91d4863 Fix a crash when network is slow. 2016-09-27 05:58:47 -05:00
Stuart Buchanan
14f20e4165 Add support for building meshes. 2016-09-22 20:40:26 +01:00
James Turner
465be55100 Tweak launcher layout margins.
Trying to squeeze things back into an XGA screen. Will backport once
I get feedback.
2016-09-08 14:49:52 +01:00
James Turner
feb10c4c43 Launcher sets —no-default-config automatically. 2016-09-08 11:41:40 +01:00
James Turner
0d069f2581 Fix launcher cmd-Q behaviour. 2016-09-08 11:41:21 +01:00
James Turner
db31e0d49c —config options can load non-XML files
Expand existing —-config option to read either property-XML files (as
it previously did) but for non-XML files, to parse them as command
line argument files.
2016-09-07 23:30:49 +01:00
James Turner
4294966781 Fix setting start offset with MP enabled. 2016-09-07 22:51:27 +01:00
Curtis L. Olson
7da08db463 Update default aircraft hangar catalog.xml url. 2016-09-07 11:39:37 -05:00
Curtis L. Olson
af3945f7f7 Clean up some 'visually' misleading indentation (where the indentation suggests
a different logic flow than is actually there.)
2016-09-06 11:11:06 -05:00
James Turner
13f8f13000 Adjust behaviour of —no-default-config option
Still read autosave and preferences.xml in this case, but skip all
config files (.fgfsrc, etc)
2016-09-05 16:15:55 +01:00
James Turner
3993adce5a Fix launcher failure when MP is enabled.
Only set —callsign argument if the user entered one.
2016-08-31 23:07:21 +01:00
Bertrand Coconnier
c226e08293 Fixed the initial location so that geodetic latitude and ASL are kept in sync. 2016-08-28 12:23:17 +02:00
James Turner
3c4542fba6 Fix re-selection of start location. 2016-08-21 10:36:54 -05:00
James Turner
904bb74036 Launcher sets location via properties.
Bypass the options system to set location from the launcher; this
allows the same code to be used in-sim for repositioning, while
keeping compatibility with other repositions approaches.
2016-08-20 19:46:19 -05:00
James Turner
1ca5ceb318 Launcher can see install Airports/ data. 2016-08-19 12:12:02 +01:00
James Turner
324f266283 Pass the install dir to Terrasync.
With Simgear commit d7d59b08a2f1a77a4247ec1a89d6ff48ed73f5c7, this
allows terrasync to be initialised from files in the install data,
which avoids downloading them again.
2016-08-18 16:23:39 +01:00
Rebecca N. Palmer
db825d3119 fix "QObject::connect: No such slot
NaturalEarthDataLoaderThread::onFinished()" error message
2016-08-15 23:10:06 +01:00
Rebecca N. Palmer
34394c91a9 fix hang on exit when multithreaded (bug 1830) 2016-08-15 07:58:40 +01:00
Erik Hofman
bd9e43e613 Fix a problem for MSVC 2016-08-12 11:48:34 +02:00
Rebecca N. Palmer
63ab28f0e6 QtLauncher: fix build with Qt < 5.4 2016-08-11 22:32:29 +01:00
James Turner
a60d07ea9c Incremental insert of NE data to the index. 2016-08-09 09:38:54 +01:00
James Turner
7cebc76b9d Async loading of NaturalEarth data for launcher. 2016-08-08 23:13:57 +01:00
James Turner
8577d74430 Move launcher summary to a separate tab.
This is an experiment to reduce the vertical height needed by the
launcher.
2016-08-08 17:47:09 +01:00
Erik Hofman
1c8542b65b Remove some debugging statements 2016-08-08 11:19:14 +02:00
Erik Hofman
fa99be7766 Use a bit less intrusive solution 2016-08-08 11:16:21 +02:00
Erik Hofman
02d037d205 Fix the startup position error. I'll leave it to Bertrand wether this is the best way to fix it 2016-08-07 11:41:03 +02:00
Torsten Dreyer
1947c100d9 Also use SBRJ as fallback.
Sigh. No real good idea how to /not/ hardcode this.
2016-08-06 23:12:43 +02:00
Alessandro Menti
2d86fc11ad Replace the NOAA METAR URL with the new, updated one 2016-08-04 20:34:34 +02:00
Erik Hofman
9ec4d7749f Add support for AeonWave 2016-08-04 18:43:10 +02:00
James Turner
ffdf542871 Launcher: fix ‘midnight’ time of day option.
TimeManager uses ‘midnight’ so we need to do the same.
2016-07-31 23:24:51 +01:00
James Turner
b06f4208e4 Adjustments to mouse picking API 2016-07-31 22:44:03 +01:00
James Turner
b8e2fb07df Port more HUD code to use line-segment list. 2016-07-31 22:44:03 +01:00
Erik Hofman
c17c3595c8 Set /sim/rendering/initialized to true at the appropriate moment and use it instead of /sim/initialized for the messagebox 2016-07-21 13:55:31 +02:00
Erik Hofman
08916602bb Make sure FlightGear is initialized before using the PUI dialog box, dump the the console otherwsise 2016-07-21 13:42:09 +02:00
Erik Hofman
e2216891be Move the PUI dialog code to James' new messagebox code and use that one instead for SG_LOG_POPUP to get a native popup window if available and fall back to a PUI one if not 2016-07-21 08:56:05 +02:00
Erik Hofman
5ab2d82c89 Show a popup dialog for every SG_POPUP message in the queue 2016-07-20 15:03:15 +02:00
James Turner
e30c886068 Adjust runway startup position with MP enabled
Relocate the start-up position to a plausible hold-short position
when MP is active and a runway start is requested. This does not (yet)
use ground-net data to identify a real hold-short position.
2016-07-17 21:11:14 +01:00
Erik Hofman
f1f2e9f21d Brendan Black:
when active does not touch the way the YASim jet calculates fuel flow, but separates out the afterburning component of thrust, calculates the TSFC of that component and uses the same method of fuel flow calculation for the afterburning component then adds it to the existing fuel flow

When inactive (atsfc doesn't exist or is zero) it just behaves exactly as before

I finally got around to testing this small patch thoroughly, and I'm satisfied that it doesn't affect anything else & works across many different versions (i've been testing it with current as it has changed over the last 7 months)
2016-07-17 11:30:07 +02:00
James Turner
4e239d2628 Fix persistence of on-ground location. 2016-07-16 18:23:48 +01:00
James Turner
07109d79f5 Improve rendering of longer parking names. 2016-07-16 17:49:12 +01:00
James Turner
e765d1c0fa Enforce a minimum pixel width for runway clicking
- ensures runways can be clicked when zoomed out.
2016-07-16 17:48:55 +01:00
James Turner
d90b8dcb33 Fix selection of parking positions by clicking. 2016-07-16 16:57:19 +01:00
James Turner
38202b0774 Launcher: show selected parking in yellow. 2016-07-16 12:07:34 +01:00
James Turner
4aee633be3 Fix starting up at a parking location.
Move parking-pos selection to finalizePosition, so that dynamics and
ATC controllers are available and work correctly.
2016-07-16 11:45:30 +01:00
James Turner
c0d93235de Fix for launcher always enabling MP 2016-07-15 22:48:37 +01:00
James Turner
100e8bf2b2 Further SGPath API usage improvements. 2016-07-15 16:49:13 +01:00
James Turner
ecb8ec57c0 FlightGear path API tweaks 2016-07-15 10:16:08 +01:00
James Turner
d800c49cb9 Custom MP server support. 2016-07-12 16:52:59 +01:00
James Turner
2eb5e6f0f4 Merge /u/jbicha/flightgear/ branch next into next
https://sourceforge.net/p/flightgear/flightgear/merge-requests/49/
2016-07-11 09:04:58 +00:00
Bertrand Coconnier
a1a7aa267c JSBSim sync.
* Fixed the initial conditions settings (geodetic altitude is now correctly computed).
* FGLGear reports the time at which it detected a violent ground hit (aka crash)
* Doc update of the kinematic component
* TurboProp code cleanup with the removal of lots of obsolete/no-op members.
2016-07-10 14:45:09 +02:00
Jeremy Bicha
25928bf614 Use CMAKE_INSTALL_BINDIR
Allow /bin install directory to be overriden. Debian for example uses this
to install FlightGear to /usr/games/ instead of /usr/bin/

https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
2016-07-09 18:52:58 -04:00
James Turner
9650cf4e6a Initial MP support in the launcher. 2016-07-08 09:36:54 +01:00
James Turner
7e607b8403 Fix fgValidatePath on Windows 2016-07-04 22:22:32 +01:00
James Turner
7870e03faf Build fixes for yasim tests / SGPath changes. 2016-07-04 10:17:41 +01:00
James Turner
400901c239 Update for changed SGPath::realpath signature 2016-07-04 09:06:42 +01:00
James Turner
8e875b22f5 fgValidatePath uses SGPath 2016-07-03 23:59:40 +01:00
James Turner
fc3d47cd34 More std::ifstream -> sg_ifstream 2016-07-03 23:48:44 +01:00
James Turner
7f3fe584e3 Update for path-aware easyXML API 2016-07-03 23:43:39 +01:00
James Turner
9cffcf63ae Further SGPath encoding fixes. 2016-07-01 04:54:29 -05:00
James Turner
40b74c4e32 Fix an assert on Windows 2016-06-29 16:25:42 +01:00
James Turner
0b11dd626a Further Windows SGpath fixes 2016-06-28 16:52:42 +01:00
James Turner
6d0c2070fd Use future-proof SGPath APIs.
Remove uses of .str(), .c_str() and some other methods of SGPath.
Pass SGPath directly where possible, or explicitly convert to the
appropriate 8-bit encoding.
2016-06-28 10:08:38 +01:00
Erik Hofman
1eb6fb65dd Use the SimGear sample format types 2016-06-27 13:21:13 +02:00
Bertrand Coconnier
54274a4b9c convert another path to std::string before using it to prevent a compiler error 2016-06-25 21:26:50 +02:00
Erik Hofman
e165fc5ebe convert the path to std::string before using it to prevent a compiler error 2016-06-25 15:00:35 +02:00
Erik Hofman
7f4fe977a1 Convert PKGLIBDIR to SGPath before returing it to prevent a compiler error 2016-06-24 12:54:01 +02:00
James Turner
16814800ce Use Paths instead of strings. 2016-06-22 17:36:05 +01:00
James Turner
03ecac9dbc Work with new SGPath API. 2016-06-22 17:36:05 +01:00
James Turner
6f95e61da8 For stable versions, download data tarball directly
Part of https://sourceforge.net/p/flightgear/codetickets/1865/
2016-06-17 22:48:24 +01:00
James Turner
1d912c91df Avoid overlap of ratings / progress bar
Part of issues mentioned in:

https://sourceforge.net/p/flightgear/codetickets/1865/
2016-06-17 22:42:33 +01:00
James Turner
e4e0db5cac Aircraft-states feature. 2016-06-17 18:15:35 +01:00
James Turner
3f7e59a1a5 Allow scenery installation from the launcher.
Replaces FGadmin functionality.
2016-06-15 22:28:54 +01:00
Erik Hofman
010d13445a Code cleanup after fixing the sound position and orientation 2016-06-14 14:11:12 +02:00
Erik Hofman
3963d2cdee Do not use properties but get the position and orientation information straight from the view manager 2016-06-13 13:50:40 +02:00
Bertrand Coconnier
a61c0bfdb4 Sync'ed with JSBSim: avoid the lag in <kinematic> while trimming. This allows the trim on ground for the P51 to succeed. 2016-06-12 17:04:35 +02:00
Bertrand Coconnier
dc7f065e08 Sync'ed with JSBSim:
* Fixed the trim on ground algorithm. Now JSBSim aircrafts should no longer be 'dropped' on the runway at start.
* Removed a correction on the propeller induced velocity that was giving erratic results when the aircraft aero velocity is very small.
* Various source comments updates.
2016-06-12 11:36:45 +02:00
James Turner
a3d660e423 Revert "Special case this define"
This reverts commit 58731a01e2.
2016-06-09 20:34:43 +01:00
James Turner
58731a01e2 Special case this define 2016-06-09 16:20:25 +01:00
James Turner
e672626558 Explicitly shut down logging
- needed to call FreeConsole on Windows.
2016-06-09 11:04:32 +01:00
James Turner
3a15b2f979 Launcher: fix a crash on searching locations
When hitting return multiple times, could hit a null-pointer
crash here.
2016-06-09 11:04:32 +01:00
James Turner
9c612af124 Improved feedback from scenery download. 2016-06-09 11:04:32 +01:00
James Turner
95f86b658c Hide add-ons tab when running launcher in-app 2016-06-08 12:00:35 +01:00
James Turner
861b682acf VS2015 fixes
Explicitly specialize these templates.
2016-06-01 22:57:11 +01:00
Erik Hofman
1a0f3d8826 Revert some debugging code which krept in 2016-05-28 10:05:09 +02:00
Erik Hofman
ea6e1c9854 Fix the header name change from sample_openal.hxx to sample.hxx 2016-05-28 09:57:03 +02:00
Bertrand Coconnier
f25304ace5 Tentative to fix JSBSim bug SF #115 : don't compute cl-squared when qbar is too low otherwise its value will go through the roof and so will the induced drag. 2016-05-27 13:50:35 +02:00
Erik Hofman
b9c2ddb94f Merge branch 'next' of ssh://git.code.sf.net/p/flightgear/flightgear into next 2016-05-27 08:06:12 +02:00
James Turner
5d624b4882 Fallback URL when official catalog is not found.
Tolerate the case where a URL matching the exact FG version is
not found; lookup a generic URL, in the hope it supports our
version (additional changes will make this more likely)
2016-05-26 17:37:26 +01:00
Erik Hofman
94f6db5857 Prevent rf2 from becoming inf 2016-05-25 10:30:34 +02:00
Bertrand Coconnier
adeb0241ae Bug fix for JSBSim SF bug #115: P51D crashes when advance ratio goes through zero 2016-05-23 20:02:36 +02:00
Erik Hofman
013770b3f8 Merge branch 'next' of ssh://git.code.sf.net/p/flightgear/flightgear into next 2016-05-23 11:39:59 +02:00
Erik Hofman
6fb6446189 Fix file permissions 2016-05-23 11:39:40 +02:00
Erik Hofman
34011c1dec Code cleanups, code updates and fix at least on (possible) devide-by-zero 2016-05-23 11:38:05 +02:00
James Turner
7dfe556b4a Real fix for Mac deployment issues. 2016-05-21 14:00:29 +01:00
James Turner
f2273c7793 Testing if this change broke Mac deployment.
Hopefully it didn’t but the time-frame is correct and it’s just
about the only code that happens before QApplication is created.
2016-05-21 10:36:51 +01:00
Florent Rougon
959ac91a8b Add missing include in src/Navaids/NavDataCache.cxx
#include <sstream> is needed for NavDataCachePrivate::init()
which uses std::ostringstream.
2016-05-19 09:19:06 +02:00
Torsten Dreyer
a4a3659ee9 Expose the type (loc/vor) for the navradio 2016-05-18 08:28:27 +02:00
Richard Harrison
b128de3bc6 Fix MSVC10 compilation errors by using streams. 2016-05-12 12:05:28 +02:00
Richard Harrison
887916b26e Multiplayer packet boundary warnings
* Add warning if multiplayer packet boundary reached
* Add warning if string too big for remaining space in packet

ref: https://sourceforge.net/p/flightgear/mailman/message/35059961/
2016-05-12 09:38:03 +02:00
Edward d'Auvergne
977ec5063f Shift of management of the precipitation OSG scene graph to the scenery manager.
The precipitation branch of the OSG scene graph is now centrally managed by the
scenery manager rather the precipitation manager itself.  The scene graph
initialisation from the constructor has also been shifted into the new
FGPrecipitationMgr::sceneGraphSetup() function.
2016-05-03 18:44:46 +02:00
Edward d'Auvergne
b12a56b526 Prevention of the creation of multiple OSG scene graph roots.
As the scenery manager's init() function is called twice on start up, two OSG
scene graph roots would be created.  A number of scene graph branches would be
initalised on the first root, but then be lost as the second is created.  This
fixes the precipitation branch, for example.
2016-05-03 18:42:43 +02:00
Florent Rougon
2b8937c2c2 apt.dat parser: indentation fixes; add a comment
- The first place where indentation is fixed was really misleading, at
  least.

- The added comment "'line' may end with an \r character [...]" just
  clarifies something that has been there for ages, to avoid people
  falling into the trap.
2016-04-27 10:57:19 +02:00
Florent Rougon
d85fc7b7e7 apt.dat parser: various little improvements
- don't duplicate the line buffer (array of char as well as
  std::string), it is not useful here;
- don't corrupt (truncate) input lines longer than 2048 bytes: there is
  no such limitation in the apt.dat v1000 format spec;
- fix comments handling: the apt.dat v1000 format spec states they must
  start with *two* '#' characters.
2016-04-27 10:39:21 +02:00
Florent Rougon
b0b81bcd3e apt.dat parser: better input stream handling
- use ( in.getline(...) ) as the main loop condition instead of
  ( ! in.eof() ). This should behave better (see
  <https://gehrcke.de/2011/06/reading-files-in-c-using-ifstream-dealing-correctly-with-badbit-failbit-eofbit-and-perror/>);
- check in.bad() after exiting from each reading loop; if the exit was
  caused by an error, log an appropriate message and throw an
  exception.
2016-04-27 10:39:21 +02:00
Florent Rougon
d6f0bc6fb5 apt.dat parser: separately handle the first two lines; fix line counting
- The first two lines of apt.dat have their own special syntax -> handle
  them separately. Before this commit, the test "is the first character
  an 'I' or an 'A'?" was done for *every* line of apt.dat, while it is
  only relevant for the first one.

- Fix counting of the current line number (it was most of the time
  0-based so far, which could be seen in error messages, because the
  second line of apt.dat was absorbed without going through the common
  code path where lines are normally read at the top of the while loop).
  With this commit, line numbers in apt.dat are consistently counted
  starting from 1.
2016-04-27 10:39:21 +02:00
Florent Rougon
85653f04d4 apt.dat parser: remove useless code
Remove useless code before parsing the "row code" (terminology from the
apt.dat v1000 spec). The row code is parsed with atoi(), which will
automatically stop at the first space found if it saw at least one
digit, thus there is no need to replace it with '\0', AFAICS.

One could replace the existing atoi() call with things that do better
checking, but my tests showed that would be a bit slower, so I let it
this way (tried with std::istringstream and strtol()).
2016-04-27 10:39:21 +02:00
Florent Rougon
a43786f8dd apt.dat parser: clearer log and exception messages
- the 'apt_dat' variable introduced here will be used in further
  commits;
- use two spaces for indentation, as seen in most of the file.
2016-04-27 10:39:21 +02:00
Richard Senior
29fe6569c4 Fix incorrect QNH in spoken ATIS when using live weather fetch
When using live weather fetch, the QNH should be obtained from
environment/metar/pressure-inhg.

See: http://sourceforge.net/p/flightgear/mailman/message/35037125

Add new method getQnhInHg to ATISInformationProvider and its implementations
to avoid rounding errors converting from hPa back to inches in ATIS reports.

The CurrentWeatherATISInformationProvider (used when live weather fetch is
not in use) continues to use the property environment/pressure-sea-level-inhg.
This produces the incorrect QNH at airports significantly above sea level
but this needs fixing elsewhere to calculate the correct QNH.
2016-04-26 10:52:29 +01:00
Richard Senior
f825bb4f3c Eliminate use of non-standard round() function in ATISEncoder
Use of round() produces compilation errors with MSVC10 and the build server
2016-04-26 10:42:48 +01:00
Torsten Dreyer
5c0a477a47 Slightly better handling of setting initial pos
don't use KSFO as default when an unknown ID was
specified for --airport arg
TODO: don't hardcode default airport
2016-04-24 10:42:58 +02:00
Richard Senior
13f31782a1 Improvements to spoken ATIS
- Add section tag to support inclusion of ATIS fragments.

- Add visibility, QNH and cloud tokens to support new ATIS formats.

- Add support for starts-with, ends-with and contains comparisons in
  conditionals, including negated versions.

- Strip and convert case in comparisons.

- Speak VRB wind direction as "variable".

- Speak zeroes in fractional part of QNH inHg.

- Force US voice in US, Canada and Pacific; UK voice in UK.
2016-04-24 10:42:26 +02:00
James Turner
2da1d38c56 Clearer aircraft search prompt. 2016-04-17 18:00:37 +01:00
Alessandro Menti
98a6b60b00 Launcher: silence 'Unknown aircraft URI scheme' warning on empty selection
------------------------------------------------------------------------
If no aircraft is selected in the launcher, the routine
AircraftItemModel::indexOfAircraftURI is called with an empty QUri,
triggering a warning in the terminal.

This commit removes such warning by ignoring QUris with empty schemes
(the routine still returns an invalid index).
2016-04-17 17:55:05 +01:00
Alessandro Menti
550dde314f Launcher: do not launch the simulator when closing the Qt launcher with ESC 2016-04-17 17:54:41 +01:00
Alessandro Menti
4820026907 Launcher: fix window flags on the "Add catalog" progress dialog 2016-04-17 17:54:02 +01:00
Alessandro Menti
e9e05081d5 Launcher: state that it is needed to press Enter to search for the airport 2016-04-17 17:53:36 +01:00
Alessandro Menti
0381ba8468 Launcher: disable Close button on the initial progress dialog 2016-04-17 17:53:24 +01:00
Alessandro Menti
34fd51d35c Launcher: spelling fix in "Add Catalog" dialog window 2016-04-17 17:53:02 +01:00
Bertrand Coconnier
43f2daa7ae JSBSim: - Fixed the forces/hold-down feature. The velocities are now zeroed when the property is set which should prevent aircraft from drifting as has been reported by G. Agostinho.
- Fixed a bug that was skipping the <system> initialization.
2016-04-16 14:49:12 +02:00
James Turner
bbd15eb370 Fix a typo 2016-04-15 18:03:01 +01:00
James Turner
a63da0cbde Minor improvement to hangar list in the launcher. 2016-04-15 17:27:29 +01:00
James Turner
31cad6d384 Fixes to launcher description rendering. 2016-04-15 17:21:49 +01:00
James Turner
6095646a62 Prompt the user when the default hangar is missing.
In the Qt launcher, when the default hangar isn’t found, show
a hint in the aircraft list.
2016-04-15 17:06:53 +01:00
James Turner
c15e4753ac Different fix for traffic shutdown crash.
Fix for: https://sourceforge.net/p/flightgear/codetickets/1864/
2016-04-15 16:26:54 +01:00
James Turner
43add4f820 Fix stray back-button in Qt launcher
- when no location is set, don’t show the back button.
2016-04-14 18:54:27 +01:00
James Turner
7a36b96790 Update from SimGear API change
- support new HTTP cancellation API
2016-04-14 09:33:28 +01:00
Stuart Buchanan
56374621c5 Make LOD of buildings/trees/objects/STG configurable.
Now using /sim/rendering/static-lod/rough.
2016-04-08 22:38:17 +01:00
James Turner
5e4063b761 Move launcher settings store inside FG_HOME
Settings now in .ini format, at $FG_HOME/flightgear.org/FlightGear.ini
2016-04-08 10:40:26 +01:00
James Turner
5341d327fd Restructure paths handling in the launcher
- move the dialog into a new ‘add-ons’ tab

- separate out ‘restore settings’ from selecting a new fg-data

- actually relaunch the app
2016-04-08 10:26:34 +01:00
Torsten Dreyer
f837f1e808 Merge /u/sanhozay/flightgear/ branch next into next
https://sourceforge.net/p/flightgear/flightgear/merge-requests/35/
2016-04-07 09:47:01 +00:00
Richard Senior
78de2af130 Allow ATIS format specifications to compare tokens against text values
Prior to this change, it was only possible to compare the values of tokens
to each other for use in conditionals, e.g. landing and departing runway.
This change allows comparison of a token to a text value, e.g. to compare
wind speed to zero.
2016-04-07 00:58:34 +01:00
Erik Hofman
02174a1df6 Add the latest fixes and expose all inertias in the property tree 2016-04-06 14:26:30 +02:00
James Turner
ca6424f76a Fix a reset crash with pager threading.
Ensure pager thread is stopped before we touch
the sgUserData reference to the main props tree.
2016-03-28 23:50:47 +01:00
James Turner
08ea386197 Fix corrupt HUD fonts
osg::texture2D changes GL_UNPACK_ROW_LENGTH, which fntLoadTXF is not
prepared to deal with. Reset the value back to 0 before loading +
caching TXF fonts on the PLIB side.
2016-03-28 22:54:24 +01:00
James Turner
c29fa35840 Updated Canvas adaptor getImage API
Return the Image by ref ptr instead of raw pointer.
2016-03-26 20:25:31 +00:00
James Turner
e8398d5cee Fix Clang unused member warnings in JSBsim. 2016-03-26 20:24:57 +00:00
James Turner
6fc2403449 Fix iterator const-ness. 2016-03-24 20:23:39 +00:00
James Turner
5baca8598f Improve download-dir behaviour.
When set on the command line, will be used for aircraft packages. When
set in the Qt launcher, will also be used for aircraft downloads at
all times.

When changing the path in the launcher, the set of aircraft catalogs
is refresh automatically. Note the default catalog may need to be
re-installed.
2016-03-24 15:10:06 +00:00
James Turner
733e3b3f0c HTTP subsystem has a default name.
Switch to using type-safe accessors now.
2016-03-24 15:08:38 +00:00
James Turner
88bfaca2b3 New options setting/clearing helpers. 2016-03-24 15:05:03 +00:00
James Turner
ff7b82885f Fix for view look-at orientation bugs.
Force a manual re-calc of view parameters inside update. Will refactor
this in the future since shouldn’t really be necessary.

Ticket: https://sourceforge.net/p/flightgear/codetickets/1855/
2016-03-24 12:26:16 +00:00
James Turner
cbf16b7966 Fix copy-paste bug setting season in the Qt guy
Spotted by Adrian Serrano!
2016-03-22 10:56:05 +00:00
James Turner
d0c341fa47 Guard against a crash. 2016-03-22 10:42:21 +00:00
Erik Hofman
209194ecba Reload user preferences after reading the video configuration file 2016-03-21 11:50:11 +01:00
Florent Rougon
0cfa4ced9c Make --metar automatically imply --disable-real-weather-fetch
The --metar option has no effect unless --disable-real-weather-fetch is
also passed. This often makes users believe that --metar doesn't work.
Change the implementation for --metar so that it automatically implies
--disable-real-weather-fetch.
2016-03-20 19:56:18 +01:00
Torsten Dreyer
585b4a7f70 Fix "failed to load file: Models/..."
After removing /Models from FGData loading of shared models from
within a scenery model failed because the ResourceManager did not know
about additional scenery paths.
2016-03-19 21:08:24 +01:00
James Turner
74f17d2882 Fix missing menubar on Mac in some setups
- Only clear the OSG ‘pose as standalone’ flag when we really show
  a dialog, as opposed to when we /might/ show.

Tested:
 - Qt build using launcher
 - No Qt build 
 - Qt build but launcher not requested
2016-03-19 14:46:11 +00:00
Erik Hofman
e1bb47bc89 Add support for Video adapter rendering presets 2016-03-19 13:10:36 +01:00
Torsten Dreyer
1bf5fe1c27 Fix for FreeBSD and a typo
Fix provided by Ganael LAPLANCHE, thanks!
2016-03-12 20:55:46 +01:00
Torsten Dreyer
a1e81a2fdc Make some more noise if (stale) fgfs.pid file exists 2016-03-08 18:37:32 +01:00
Durk Talsma
31c66226e1 AI traffic refused to take-off, because the TrafficRecord destructor would unassign an AIAircraft from it's ATC. This caused it to get stuck in front of the runway and block all other traffic.
This patch may introduce an occasional crash on exit again, because it effectively undoes commit [a972df]. I'll try to find a better fix for that later on.
2016-03-06 21:23:26 +01:00
James Turner
43b4db7ef7 Improve UI around adding aircraft dirs
- Check if the selected path, or an ‘Aircraft’ subdir,  contains
some -set.xml files, and if not, warn the user.
2016-03-05 09:35:02 +00:00
James Turner
688ae7d156 Bugfix: Qt launcher, enable variant aircraft on-disk
When mapping a URI to a QModelIndex, we were only considering the 
primary aircraft path, for on-disk aircraft as opposed to packages.
2016-03-05 09:34:16 +00:00
Torsten Dreyer
4f8cbbb204 Fix #1851, wrong type in multiplayer messages
See https://sourceforge.net/p/flightgear/codetickets/1851/
for details
2016-02-29 22:29:32 +01:00
James Turner
1aa6482a59 Fix bug #1845, closing the Qt launcher
Intercept the close event and quit the app instead of continuing to
run the main FlightGear application.

https://sourceforge.net/p/flightgear/codetickets/1845/
2016-02-24 21:50:48 +02:00
Rebecca N. Palmer
41b78ce150 Nasal security: allow reading explicit --terrasync-dir
(but not /sim/terrasync/scenery-dir - https://bugs.debian.org/780716 )
Needed for animated jetways:
https://sourceforge.net/p/flightgear/mailman/message/34870606/
2016-02-21 20:25:02 +00:00
James Turner
de959a14f3 Rename Viewer/viewer.cxx to view
- keep class and file names in sync.
2016-02-17 21:25:39 +00:00
James Turner
1515154e12 View::updateData becomes a private helper. 2016-02-17 21:25:39 +00:00
James Turner
5b81333768 View offset/target-offset props are tied
- make these View properties work like all the others, i.e
  bound and unbound when the view changes.
2016-02-17 21:25:39 +00:00
James Turner
5629cf1a8d Remove legacy ‘axes/lat’ and ‘axes/long’ props.
- only exits to support some legacy joystick hat configs,
  which have been updated to use the goal- properties directly.
2016-02-17 21:25:39 +00:00
James Turner
7b08c621b4 Make many View APIs private
- many things are now only needed by tied methods, and 
  hence can be made private.
2016-02-17 21:25:39 +00:00
James Turner
a3382fec6d Simplify setting view eye/target offsets 2016-02-17 21:25:39 +00:00
James Turner
e404ebc38a Sink more properties into View 2016-02-17 21:25:39 +00:00
James Turner
27d739084a View-manager binds like a normal subsystem.
- no longer need the unusual init-bind order
2016-02-17 21:25:39 +00:00
James Turner
00a4f1ecbb Clean up view-number property handling 2016-02-17 21:25:39 +00:00
James Turner
ae1d96cdfb Move FOV property into View 2016-02-17 21:25:39 +00:00
James Turner
daf8c79705 View-Mgr absolute position is gone. 2016-02-17 21:25:39 +00:00
James Turner
65d5038962 Tie view orientations directly
- remove need for cached orientations in view-manager
2016-02-17 21:25:39 +00:00
James Turner
3171cbce75 copyToCurrent removed. 2016-02-17 21:25:39 +00:00
James Turner
bf69781ae0 Remove dead code. 2016-02-17 21:25:39 +00:00
James Turner
fa4a5e7a64 Better types for eye/target position 2016-02-17 21:25:39 +00:00
James Turner
03d5e55b57 Move data updating into the View class 2016-02-17 21:25:39 +00:00
James Turner
7391b9d76a ViewManager::copyToCurrent is a no-op 2016-02-17 21:25:39 +00:00
James Turner
655ac851e0 Start moving view-manager logic into View
- work in progress, goal is to make copyToCurrent and most of
  the bind/unbind logic sink into each specific View, avoiding all the
  null pointer checks in view manager.
2016-02-17 21:25:39 +00:00
James Turner
8c918c6cec Make View::set_clean private. 2016-02-17 21:25:39 +00:00
James Turner
d4d2121641 View can created itself from config properties
- use in view manager
- make View constructor private
2016-02-17 21:25:39 +00:00
James Turner
02ff854603 Re-Name FGViewer to flightgear::View
- avoids confusion with osgViewer and fgviewer application.

(source files to be renamed in a follow-up commit)
2016-02-17 21:25:39 +00:00
James Turner
e60d9a191e Viewer: move camera-group to view manager
- also devirtualise many methods in FGViewer
2016-02-17 21:25:39 +00:00
Edward d'Auvergne
97f8cdaaea Fix for the particle system.
The problem was that the change to make FGScenery a standard subsystem caused
the particle OSG group to no longer be inserted into the scene graph.  The
solution was to convert the particle group to be set up as a standard branch of
the scene graph, alongside the terrain, models, aircraft, and interior branches.
The particle system is now set up as part of the init() subsystem function call,
so it is compatible with the new subsystem design.
2016-02-16 17:33:40 +01:00
Edward d'Auvergne
34daa4de0b HUD fix for MSVC math.h incompatibility with C-99 and the round() function. 2016-02-11 19:36:32 +00:00
Rebecca N. Palmer
e1d0699bdb add new QtFileDialog to avoid using Nasal in file selectors
(and hence avoid applying Nasal security rules to them)
2016-02-10 22:58:56 +00:00
Rebecca N. Palmer
16e6009255 Nasal security: give a more user-friendly error on self-check fail
https://sourceforge.net/p/flightgear/mailman/message/34701972/
2016-02-10 22:54:52 +00:00
Edward d'Auvergne
c889198d09 Redesign of the latitude and longitude formatting for the HUD.
This follows from http://thread.gmane.org/gmane.games.flightgear.devel/78650 and
resolves the sign bug https://sourceforge.net/p/flightgear/codetickets/1778/ .

Combined with a matching change to FGData, this changes the HUD formats from the
current set of 3 (note that the text in brackets is not shown in the HUD
preferences PUI dialog, but is show here for reference):

    0) Decimal degrees (37.618890N -122.375000W)
    1) Degrees, minutes (37*37.133N -122*22.500W)
    2) Degrees, minutes, seconds (37*37 08.0 N -122*22 30.0 W)

to (here the text in brackets will be shown in the PUI dialog):

    0) DDD format (37.618890N 122.375000W)
    1) DMM format (37*37.133'N 122*22.500'W)
    2) DMS format (37*37'08.0"N 122*22'30.0"W)
    3) Signed DDD format (37.618890 -122.375000)
    4) Signed DMM format (37*37.133' -122*22.500')
    5) Signed DMS format (37*37'08.0" -122*22'30.0")
    6) Zero padded DDD (51.477500N 000.461389W)
    7) Zero padded DMM (51*28.650'N 000*27.683'W)
    8) Zero padded DMS (51*28'39.0"N 000*27'41.0"W)
    9) Trinity House Navigation (51* 28'.650N 000* 27'.683W)
2016-02-10 21:49:56 +00:00
Rebecca N. Palmer
f749953493 Nasal security: don't break file dialogs
Include the directory itself when allowing reading
Don't kill the script on a denied directory read
2016-02-09 23:17:41 +00:00
Rebecca N. Palmer
74356e84f7 Nasal security: make directory() use fgValidatePath
Being able to list arbitrary directories is a privacy violation;
existing in-fgdata uses of this are all permitted paths
(i.e. not Terrasync; FileSelector doesn't use it)
2016-02-06 21:26:05 +00:00
James Turner
c72309360e Defensive handling of locales.
- Use setlocale() to ensure consistent handling of locales and
  string handling irrespective of whether or not QCoreApplication
  is invoked. Forces a the C locale for numerics and collation,
  since many pieces of FG assume this.
2016-02-02 20:44:46 +00:00
Erik Hofman
5ef3413373 Add the latest batch of JSBSim changes. Tested with the Shuttle 2016-01-29 12:23:58 +01:00
James Turner
9172a8a8a9 VS2013 fixes for some FDMs. 2016-01-27 14:00:09 +00:00
James Turner
bb9fd9defe Fix a bug with updating packages.
- always refresh the catalogs each launch, so we don’t get mismatches
  between the cached copy the and package zips.
2016-01-26 16:46:58 +00:00
James Turner
acb630095d Possible fix for Mac strncmp crashes. 2016-01-26 07:48:30 +01:00
James Turner
2677b3a226 Use target_include_directories in some places.
I didn’t know about this feature when doing the original CMake files,
we can use this to target header-file includes more precisely.

(Probably more cases exist that can be changed from global to target-
specific includes)
2016-01-26 07:48:30 +01:00
Gijs de Rooy
9e7c3c5c89 Fix #1744: disable commradio when unserviceable 2016-01-25 16:38:57 +01:00
James Turner
81792bd6d0 Adjust fg root processing order
- ensure fg-root and FG_ROOT are higher precedence than the Qt gui
2016-01-19 18:32:20 -05:00
James Turner
d81d353940 Improved fg-root control from the Qt Launcher
- add a button to the main dialog, explaining how to adjust the 
  fg-root path via the GUI
- tweak the GUI flow to support explicitly changing the path even
  when the default path is acceptable.
2016-01-18 20:06:43 -05:00
bcoconni
bf851605fb Fixed a bug which caused the solid propellant thrusters of the space shuttle to be unconditionnally ignited during the trimming. 2016-01-17 10:26:25 +01:00
James Turner
e37e0d1bcf New log class for TerraSync 2016-01-16 15:50:13 -06:00
Bertrand Coconnier
95b932e9b3 JSBSim dropped the support of the simplex trim code 2016-01-16 19:36:32 +01:00
Bertrand Coconnier
f526dcdf3a Fixed the initialization process for JSBSim models: the error message "FGTrim::calcRotation DistPlane^2 larger than sqrRadius" should no longer be issued 2016-01-16 19:32:50 +01:00
bcoconni
4d2f9e7955 Remove the error message about the property atmosphere/P-sl-psf that can't be tied 2016-01-16 13:14:51 +01:00
Torsten Dreyer
6f09b9e31e httpd: expose /fg-home and /fg-root 2016-01-13 13:25:16 +01:00
James Turner
e3fe8ae199 Log options to INFO level when processing
- ensures they occur in the fgfs.log which should aid problem
  tracing.
2016-01-12 17:33:57 -06:00
James Turner
eb0f724c13 Fix a typo breaking some takeoff-state logic. 2016-01-12 17:26:06 -06:00
James Turner
e32b02b28f Launcher: fix slot name for old-style syntax 2016-01-12 17:25:54 -06:00
James Turner
ef1fd62b4b Fix an unused variable in non-developer-warning mode. 2016-01-12 12:50:58 -06:00
James Turner
a549c8fe45 Fix unused constants in YASim 2016-01-12 12:50:44 -06:00
James Turner
c62b004438 Fix many clang errors in UIUC code
- because uiuc_warning_error always called exit(-1), it can be marked
  no return, so Clang realises that when it’s used in the ‘else’
  side of a parsing test, uninitialised variables in the enclosing
  call site are safe.

(Requires Simgear update to define SG_NO_RETURN helper)
2016-01-12 12:50:31 -06:00
James Turner
dc17b5dda2 Fix unused variable in LaRCsim 2016-01-12 12:49:14 -06:00
James Turner
a972df05dc Fix a potential use-after-free in ATC code
- when dynamics shuts down the ATC controllers, they clear their
  traffic vectors (destroying the records), but we didn’t notify
  the AI aircraft of this. Ensure the controller is cleared so
  the AI aircraft shutdown doesn’t crash.
2016-01-12 12:22:23 -06:00
Erik Hofman
508c367c5b Sync. again 2016-01-12 19:05:51 +01:00
Erik Hofman
6e1b5e9f2e Fix a singed/unsigned warning 2016-01-12 19:05:51 +01:00
Torsten Dreyer
296849cf3d Fix a bug for allowed paths
Under some conditions on my system
aircraft_paths.begin() was equal to scenery_paths.end()
This resulted in neither of them being added to read_allowed_paths
followed by failure to load Nasal scripts from the aircraft directory.

This might happen, if scenery_paths gets allocated just before aircraft_paths
in memory.
Better loop across the desired lists instead of using fancy tricks with
the iterator.
2016-01-12 11:19:26 +01:00
James Turner
0250d2ee5b Bugfix: pause works for JSBsim/Yasim again 2016-01-11 11:47:40 -06:00
Erik Hofman
f19c8ac05d Apperently maybeRestoreAircraftSelection() needs to be a slot 2016-01-11 09:46:16 +01:00
James Turner
409ffc971d Fixes to launcher aircraft delegate.
- fix some text size computation issues
2016-01-10 23:46:44 -06:00
James Turner
4396c035df Linux build fix. 2016-01-10 22:11:32 -06:00
James Turner
f2bf30bcc7 Current time of day (warp) fixes:
- sim-speed-up (a/A keys) offsets warp correctly. This means at 4x speed
  up the warp will increase by 3 seconds for one elapsed real second.
  In practice this means simulation elements timed using sim ‘current time’
  will be correctly synchronised with those using simulated elapsed time.

  (AI traffic being a prime example of this)

- warp-delta (t/T keys) is independent of frame rate, and works when
  paused. The warp-delta values in the keybindings / GUI dialog
  will need to be updated since warp-delta in now seconds-per-second,
  as opposed to seconds-per-frame.
2016-01-10 22:10:10 -06:00
James Turner
d10d279064 Launcher finds parking positions from scenery
- change launcher to examine the scenery paths and hence load
  ground-net files for airports to populate parking data.

- refactor ground-net XML parsing to use FGGroundNetwork only, not
  AirportDynamics. 

- change parenting  of GroundNetwork to Airport, since it contains
  immutable data now.
2016-01-10 16:38:01 -06:00
James Turner
4befe0e6ea Launcher: Maintain aircraft selection better
- when launching or toggling settings, try to keep the current
  aircraft selected and in-view.
2016-01-10 13:47:57 -06:00
James Turner
b0ee3f98f3 ‘only show installed checkbox’ for Qt launcher
- will be replaced when I think of a prettier UI, but this
  feature is important to have for now.
2016-01-10 12:56:46 -06:00
James Turner
078366cbf7 Fix some FDM warnings with Clang 2016-01-10 12:55:18 -06:00
James Turner
e5c6d14cef Allow re-ordering of paths in the launcher.
- suggested by Gilberto, allow the user to set the order of the
  scenery and aircraft paths by dragging.
2016-01-09 17:17:58 -06:00
James Turner
a1b88d77ab Fallback for runway assignment logic
- when no runway use preferences XML exists, be smarter about using
  available runways. Makes the common case of using two parallel
  runways for arrivals and departures work, greatly improving AI
  traffic behaviour.
2016-01-09 13:48:00 -06:00
James Turner
704aba9041 Fix a dumb AI traffic bug I introduced. 2016-01-06 22:27:33 -06:00
James Turner
b2bec04733 Fix acceleration path of default takeoff taxi. 2016-01-06 17:58:24 -06:00