1
0
Fork 0
Commit graph

10341 commits

Author SHA1 Message Date
James Turner
4d28146796 Give TimeManager a subsystem-name
Also modernise the lookups now this is added.
2018-01-29 10:46:08 +00:00
Thomas Geymayer
193d7b1c6f canvas: Fix receiving keyboard events 2018-01-29 09:09:29 +01:00
Thomas Geymayer
39f7fbf9fc canvas: Refactor and protect against expired pointers 2018-01-28 19:25:03 +01:00
James Turner
c035b3e9e3 Better fix for Canvas-in-PUI compositing
This seems to work everywhere, let’s try it.
2018-01-28 16:10:18 +00:00
James Turner
f076fe1c1b Fix unwanted waypoint list transparency
Ticket: https://sourceforge.net/p/flightgear/codetickets/2009/
2018-01-28 15:59:51 +00:00
ThorstenB
087995448f GPWS: add optional support for Airbus-style callouts
The "Airbus" callouts ("2500", "hundred above", "retard") are not issued
by the original mk-viii unit, but adding support helps with better
simulation for Airbus a/c. The new callouts are disabled by default, and
are enabled by a specific setting of the GPWS "category-4" configuration
value (see Wiki).
2018-01-28 16:37:31 +01:00
ThorstenB
37085f29ac GPWS: minor clean-up and performance update 2018-01-28 16:37:24 +01:00
Richard Harrison
cfbae6efb4 Multiplayer: revised filtering and move emesary bridge properties to new index.
- /sim/multiplay/transmit-filter-property-base can now filter based on property index; or have the previous mode of transmitting only generics by setting to 1.
- Move emesary MP bridge property base index to 12000 - to allow filtering of all except these (to reduce packet size).
2018-01-28 15:50:43 +01:00
James Turner
c1947b6bc4 Fix PUICamera compilation
Some blending issues remain with Canvas-in-PUI, waiting to hear back
if Thomas has nay great ideas on those.
2018-01-28 14:23:22 +00:00
jean pellotier
2e919544b9 warning removal, forgot to remove ival when addressing bug 1885
it was the commit  2f84be16f9
2018-01-28 14:49:07 +01:00
James Turner
e186fc6e2a Launcher: avoid MP start with no server selected.
Default to first server in the list, if there is no valid previous
server to restore.
2018-01-28 12:35:12 +00:00
Florent Rougon
21b8c7719e FGMouseInput: fix two uses of std::ostringstream
Seeking to the beginning doesn't clear the contents. Note that we don't
use std::ostringstream::str() either, because apparently
std::ostringstream is too complex to be easily reset to a clean state,
so we just recreate an instance every time we need.

cf. https://stackoverflow.com/a/12112642/4756009 and
    https://stackoverflow.com/questions/624260/how-to-reuse-an-ostringstream/624291#comment437178_624276
2018-01-27 11:25:48 +01:00
Florent Rougon
99c809dda0 FGMouseInput: add shutdown() and reinit() overrides
- Modify global_mouseInput in init() and in shutdown(), because *these*
  are the places where FGMouseInput is enabled or disabled.

- reinit() does shutdown() followed by init().

Note: the commented-out block starting with "FIXME: memory leak" that is
      removed here was just an outdated comment, because SGBindingList
      is an std::vector<SGBinding_ptr>, where SGBinding_ptr is a smart
      pointer type (SGSharedPtr<SGBinding>). In other words, there was
      no leak in this place---at least, not recently.
2018-01-27 11:25:10 +01:00
Florent Rougon
2eb583e9e1 FGMouseInput: improve initialization sequence
Create the FGMouseInputPrivate instance in FGMouseInput::init() instead
of in FGMouseInput's constructor. This will allow straightforward
implementation of reinit() via shutdown() and init().

Also get rid of the 'initialized' bool, since bool(d) is now equivalent
(d being the std::unique_ptr<FGMouseInputPrivate> data member of
FGMouseInput).
2018-01-27 11:25:10 +01:00
Florent Rougon
e60e519f7e FGMouseInput: refactoring: use a smart pointer for mouse_mode::buttons 2018-01-27 11:25:10 +01:00
Florent Rougon
1832ade5f2 FGMouseInput: refactoring: use a smart pointer for mouse::modes
Using std::vector<mouse_mode> instead of std::unique_ptr<mouse_mode[]>
would have been possible of course, but a bit more awkward as
vector<>::size() returns an std::size_t but all the "adjacent" code is
based on the 'int' type.
2018-01-27 11:25:10 +01:00
Thomas Geymayer
40503f3410 Update for another nasal::Context change 2018-01-24 07:41:13 +01:00
Florent Rougon
9054a51dd3 fgrcc: use octal escape sequences instead of hexadecimal ones
Octal escape sequences can be as short as 2 bytes (\0, ..., \7),
therefore they allow one to generate shorter files than hex escapes, for
the same resource contents. The line lengths won't be as even, but this
is purely cosmetic, virtually no one will ever read the resource data
string literals, so this is quite a negligible drawback compared to the
advantage of using less space in the Git repository every time resource
files are committed.
2018-01-19 08:12:24 +01:00
Henning Stahlke
f1906f3b8a YASim: name clarifications, add 'const' to arguments, add initalizers in Airplane.hpp 2018-01-18 08:48:24 +01:00
Henning Stahlke
b59aefb73a YASim: add comments, add constants, export more props 2018-01-18 07:46:03 +01:00
Henning Stahlke
a2499b02a1 YASim: name clarifications in ControlMap 2018-01-18 07:46:03 +01:00
Henning Stahlke
2841599b12 add const to argument 2018-01-18 07:46:03 +01:00
Henning Stahlke
317ad86b80 remove useless comments 2018-01-18 07:46:03 +01:00
James Turner
821ae89f64 Fix aircraft-list selection bug after searching
Reported by Brendan Black, thanks!
2018-01-14 15:04:55 +00:00
Bertrand Coconnier
9508ada1f1 JSBSim sync (Fixed memory leaks) 2018-01-14 15:20:50 +01:00
James Turner
aa9ad6a780 Fix view right-drag interaction with PUI
When PUI doesn’t handle the right-mouse down, ensure it ignores the
mouse-up event.
2018-01-14 13:17:59 +00:00
Bertrand Coconnier
bb315488e1 JSBSim synchronization.
Added the ability to specify N1 & N2 spool up/down velocity via functions for turbines.
2018-01-13 19:48:35 +01:00
Bertrand Coconnier
c9e276e5dd Removed obsolete files from JSBSim.
These files were originally included for special trim routines. But these routines are no longer maintained in JSBSim and have already been partially removed from FlightGear.
2018-01-13 19:46:41 +01:00
James Turner
08a877cb8e Message box on start if FG-home is read-only
If running with the launcher, and FG-home is read-only, show a warning
to the user, since this is probably a surprise to them.

(In non-launcher mode we don’t show the box, since it’s more likely to
be an intentional duplicate launch)
2018-01-12 22:18:59 +00:00
James Turner
1681b92c31 Silence a clang warning 2018-01-12 22:18:59 +00:00
James Turner
b4cdac238e remove_if clean-ups while auditing :) 2018-01-12 22:18:59 +00:00
James Turner
1493c0adc8 Fix missing style import in the delegate 2018-01-12 22:18:59 +00:00
Henning Stahlke
cbd5cb916f YASim bugfix: XML processing failed if <control-speed> appeared before <control-input> in XML file. 2018-01-10 21:25:52 +01:00
Florent Rougon
451f41fe0c Add-ons: lower the priority of the add-on resource provider to PRIORITY_DEFAULT
The previous priority was PRIORITY_NORMAL, which happens to be higher
than PRIORITY_DEFAULT. Even though the add-on resource provider should
be quite fast at rejecting resource paths that don't start with
'[addon=', I currently can't see any reason that justifies to give it a
higher priority than other paths added to the simgear::ResourceManager
with addBasePath(..., PRIORITY_DEFAULT).
2018-01-10 16:21:34 +01:00
Florent Rougon
39bf5d6b8a Add-ons: add fallback code for compilers without working <regex>
This is another place where the add-on code uses regexps, and so far I
had forgotten to add the fallback code for compilers that don't support
<regex> as per the C++11 standard.
2018-01-10 10:03:56 +01:00
Florent Rougon
1f2ba814a4 Add-ons: silence a compilation warning
Fix mismatch of 'struct' vs. 'class' keyword in declaration and
definition of Addon::Metadata.
2018-01-10 08:17:24 +01:00
Florent Rougon
5f50e25535 Add-ons: add method resourcePath() to addons.Addon ghosts
This method takes a string such as "this/is/a/relative/path" and returns
"[addon=ADDON_ID]this/is/a/relative/path", substituting the add-on
identifier for ADDON_ID.

This way, add-on authors don't even have to know the special syntax
'[addon=ADDON_ID]relative/path' used for add-on-specific resource paths,
and don't need to hardcode their add-on identifier inside each such path
either.
2018-01-10 01:25:50 +01:00
Florent Rougon
717fdfec39 Add-ons: register the add-on ResourceProvider with the simgear::ResourceManager
This makes it possible to look up files from add-on directories using
for instance FGGlobals::resolve_resource_path(), passing a string such
as "[addon=ADDON_ID]relative/path" as explained in the previous commit.
2018-01-10 01:25:36 +01:00
Florent Rougon
8c82fca416 Add-ons: add a simgear::ResourceProvider for add-on-specific lookup
A resource can be specified with the syntax:

  [addon=ADDON_ID]relative/path

Such a resource corresponds to the file $addon_base_path/relative/path
for the specific add-on whose identifier is ADDON_ID.

If the particular add-on isn't registered, looking up such a resource
throws sg_exception.
2018-01-10 01:25:36 +01:00
Florent Rougon
a137aed541 Add-ons: move parsing of the metadata file to a separate translation unit
This will be tidier, esp. since I am going to introduce another XML
config file.
2018-01-10 01:25:36 +01:00
Florent Rougon
4ed99dd05c Add-ons: make Addon::getMetadataFile() a private member function 2018-01-10 01:25:36 +01:00
Thomas Geymayer
7c8ab6c52a Update for nasal::Context changes 2018-01-09 23:22:55 +01:00
Florent Rougon
a999b87e06 Add-ons: rename ContactTraits to contact_traits for style consistency
This will be consistent with other traits classes such as
shared_ptr_traits (in flightgear::addons as well as in nasal
namespaces).
2018-01-08 08:05:35 +01:00
Florent Rougon
59d8dea0d7 Add-ons: use shared_ptr_traits<>::makeStrongRef(...) instead of new Foobar(...)
Replace the previously-written manual calls to "new SomeClass(...)" with
their equivalent using
flightgear::addons::shared_ptr_traits<>::makeStrongRef(). This way, when
SomeClassRef is changed from SGSharedPtr<SomeClass> to
std::shared_ptr<SomeClass>, these calls will magically use
std::make_shared<SomeClass>(...) instead of the "new SomeClass(...)"
call.
2018-01-08 08:05:35 +01:00
James Turner
d2cb99ba1d Launcher: fixes for scanning local aircraft dirs
When multiple ‘added items’ signals occur, don’t loose some entries,
always pull the full list from the aircraft cache.
2018-01-07 14:19:28 +00:00
James Turner
178c6440f6 Permit three-letter (FAA) airport identifiers
Patch from Jean-Paul Anceaux to allow some FAA but non-ICAO airports to
be used with the route-manager dialog.
2018-01-05 16:39:34 +00:00
Richard Harrison
97c1b34fa5 JSBSim: revised arrestor wire handling.
Change the arrestor wire handling as follows;

- expose property to indicate when arrestor wire has been snagged: /fdm/jsbsim/systems/hook/arrestor-wire-engaged-hook
- add property to allow the model to request that the wire is released: /fdm/jsbsim/systems/hook/tailhook-release-cmd. This permits an overspeed approach to catch the wire and then drop it.
2018-01-04 03:54:23 +01:00
Richard Harrison
2f84be16f9 Multiplayer: Do not interpolate integer values:
Jean Pellotier, 2018-01-02 : we don't want interpolation for integer values, they are mostly used
for non linearly changing values (e.g. transponder etc ...)
ref: https://sourceforge.net/p/flightgear/codetickets/1885/
2018-01-04 03:54:23 +01:00
Florent Rougon
4d36082398 Add-ons: detailed, machine-parseable metadata for authors and maintainers
(everything described here lives in the namespace flightgear::addons)

New classes: Author, Maintainer, and Contact. Author and Maintainer
derive from Contact. For each contact, the following can be defined in
addon-metadata.xml: name, email, and url. See [1] for details about the
syntax and usage policy. Nasal bindings have been updated accordingly,
there are three new ghosts: addons.Contact, addons.Author and
addons.Maintainer.

The enum class UrlType has two new members: author and maintainer. The
Addon::getUrls() method has a new signature:

  std::multimap<UrlType, QualifiedUrl> getUrls() const;

because non-empty 'url' fields for authors and maintainers contribute to
the result, and there can be an arbitrary number of authors and an
arbitrary number of maintainers defined for a given add-on---therefore,
std::map can't be used anymore.

Finally, QualifiedUrl has a new field (detail) which stores the author
name (resp. maintainer name) when the QualifiedUrl type is
UrlType::author (resp. UrlType::maintainer). Currently, this 'detail'
field is not used for other URL types, but this could be changed if
desired.

[1] https://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Docs/README.add-ons
2018-01-02 21:57:35 +01:00
Florent Rougon
843383fdc3 Add-ons: add pointer traits
flightgear::addons::shared_ptr_traits allows one to easily switch for
instance from an SGSharedPtr<T> to an std::shared_ptr<T> for "all" uses
of a particular T, and automatically have std::make_shared<T>(...) used
instead of SGSharedPtr<T>(new T(...)) when creating a shared instance of
T. This is interesting because std::make_shared<T>() allocates all
needed memory as one block, whereas std::shared_ptr<T>(new T(args...))
would perform at least two allocations (one for the object T and one for
the control block of the shared pointer).

This is done via static methods (one for each kind of smart pointer):

  shared_ptr_traits<SGSharedPtr<T>>::makeStrongRef()
  shared_ptr_traits<std::shared_ptr<T>>::makeStrongRef()

that forward their arguments in the same way as std::make_shared<T>().
2018-01-02 00:35:50 +01:00
Florent Rougon
f1e0a4e43f Add-ons: add missing include 2018-01-01 20:04:59 +01:00
Florent Rougon
7d2f35c7e3 Add-ons: update namespace in a string and a comment
These were forgotten in commit f5ab26bd71.
2018-01-01 01:14:37 +01:00
Florent Rougon
31de119169 Add-ons: alternative code for C++ compilers that don't have a working <regex>
Normally, <regex> should be available and working in any compliant C++11
implementation, however at least g++ 4.8[1] lies about its C++11
compliance: its <regex> is utterly unusable, see [2] and [3] for
details.

This requires SimGear commit ab1e2d49abdf5b1aca9035a51d9d73d687f0eba7,
for the HAVE_WORKING_STD_REGEX preprocessor symbol.

[1] Which appears to be (precisely 4.8.5) the version shipped in
    CentOS 7, and used on FlightGear's current Jenkins installation.

[2] https://stackoverflow.com/a/12665408/4756009

[3] https://sourceforge.net/p/flightgear/mailman/message/36170781/
2017-12-29 14:14:41 +01:00
Florent Rougon
ea45c4980b Merge /u/jsb1685/flightgear/ branch yasim into next
https://sourceforge.net/p/flightgear/flightgear/merge-requests/115/
2017-12-29 08:26:24 +00:00
Henning Stahlke
21aef4da70 YASim: bugfix for wing section (wrong surface positions).
Reformated and extended output of CLI tool.
2017-12-29 08:16:32 +01:00
Florent Rougon
3d12ed6ce0 Add-ons: minor changes
Changes to test_AddonManagement.cxx:

  - in testAddonVersionSuffix(), fgtest::initTestGlobals() was called
    with the wrong test name (not used anyway, but might be in the
    future);

  - in testAddon():
      * rename variable 'm' to 'addon' ('m' used to stand for the old
        class name AddonMetadata);
      * call fgtest::initTestGlobals() and fgtest::shutdownTestGlobals()
        (not technically needed, but cleaner).
2017-12-28 08:35:39 +01:00
Richard Harrison
8cfa799284 Multiplayer: add properties for Emesary MP bridge.
- The Emesary MP bridge can use any string property; however it seems sensible to separate the properties out into a distinct block.
- There is a now a type property for each bridge. This is to allow the bridge to identify its type based on what it can transfer based on function. This will allow rapid filtering of unrequired notifications within the bridge (NYI)
2017-12-28 01:12:20 +01:00
Florent Rougon
ccfb0d78ae Add-ons: whitespace-strip every leaf node contents in addon-metadata.xml files
All nodes were already stripped except <version>, <min-FG-version> and
<max-FG-version>; these are the ones affected by this change.
2017-12-26 19:45:19 +01:00
Florent Rougon
ec349c6ac5 Add-ons: add UrlType enum class, QualifiedUrl class and Addon::getUrls() method
QualifiedUrl is essentially a pair containing an enum value
(addons::UrlType::homePage, addons::UrlType::download, etc.) and an
std::string for the URL per se, with adequate getters and setters.

Addon::getUrls() is for people who wish to process all non-empty URLs
occurring as part of the add-on metadata in batch.

Mailing-list discussion:

  https://sourceforge.net/p/flightgear/mailman/message/36159711/
2017-12-26 19:44:15 +01:00
Florent Rougon
f5ab26bd71 Add-ons: move all code to the flightgear::addons namespace 2017-12-26 19:44:15 +01:00
Florent Rougon
c3b1442546 Add-ons: new supported fields: authors, maintainers, license/*, url/*, tags
- Parsing of the addon-metadata.xml file is now handled by a new static
  method of Addon:

    static Addon fromAddonDir(const SGPath& addonPath);

  This method will be reusable to gather all add-on metadata from a set
  of add-on directories (just call the method once per add-on). This
  change also simplifies AddonManager::registerAddonMetadata().

- New supported fields:

    authors
    maintainers
    license/{designation,file,url}
    url/{home-page,download,support,code-repository}
    tags

  See
  https://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Docs/README.add-ons
  for documentation on these fields.

Mailing-list discussion:

  around https://sourceforge.net/p/flightgear/mailman/message/36155660/
2017-12-26 19:43:20 +01:00
Florent Rougon
d81599efd1 Add-ons: move exceptions to their own translation unit 2017-12-25 21:24:26 +01:00
James Turner
01f0f27c84 HID-input: don’t crash when open fails
Important since hidraw devices need special permissions on Linux.
2017-12-25 18:13:03 +00:00
Henning Stahlke
2538ab717a YASim: more output for CLI tool, e.g. wingspan, area, levers, load factor... 2017-12-23 01:06:38 +01:00
Florent Rougon
c325a8d2cd Fix typos in src/Input/FGLinuxEventInput.cxx 2017-12-23 00:04:21 +01:00
James Turner
216d2328a3 Linux fixes 2017-12-22 14:44:29 -08:00
James Turner
fed8ce623b Fix Windows compilation. 2017-12-22 15:48:52 +00:00
Henning Stahlke
7e5a1bb6b9 try to fix windows build error 2017-12-21 18:56:29 +01:00
James Turner
34630f935d Fix GCC indentation warning 2017-12-20 04:04:17 -08:00
James Turner
407a6d4b3e Linux fixes for HID-input 2017-12-20 04:04:17 -08:00
James Turner
edc1d63b26 Merge /u/jsb1685/flightgear/ branch yasim2 into next
https://sourceforge.net/p/flightgear/flightgear/merge-requests/110/
2017-12-19 23:06:03 +00:00
Henning Stahlke
9289c79e05 YASIM reduce precision of lift/drag output from CLI tool to .4 2017-12-19 08:44:41 +01:00
Henning Stahlke
87149931dd YASim refactoring parser 2017-12-19 08:44:41 +01:00
Henning Stahlke
7c55aa2c4a YASim variable and method name clarification in class Surface 2017-12-19 08:44:41 +01:00
Henning Stahlke
f7c5d2b1f9 YASIM refactoring class Surface
and export more properties to proptree
2017-12-19 08:44:41 +01:00
Henning Stahlke
408e645bb2 YASIM add wing section support
refactoring of FGFDM parser
replace old helpers with lib functions from <cstring>
remove typecast that kills 'const'
add some comments and clarify variable names
2017-12-19 08:44:41 +01:00
James Turner
e630bc4be7 Make HID-Input test also conditional
Forgot to wrap this in the relevant CMake test, causing non-HID-input
builds to erroneously fail.
2017-12-18 18:22:44 +00:00
James Turner
e920dc7509 Event input layer based on HID-Api
Thus runs in parallel to the existing implementation on Linux and Mac,
but can (soon) replace the Mac code and will run on Windows eventually.
2017-12-18 17:15:55 +00:00
James Turner
d98cd3a717 Launcher: move QML files to a sub-directory 2017-12-15 14:38:23 +00:00
James Turner
f964728422 Launcher aircraft list: show counts 2017-12-15 14:38:23 +00:00
James Turner
595b0d16da Launcher aircraft: fix a layout bug 2017-12-15 14:38:23 +00:00
Henning Stahlke
e913e44aa0 YASIM type name clarification 2017-12-15 15:20:29 +01:00
Henning Stahlke
13e00b275b YASim: export more forces to prop tree for in flight debugging 2017-12-15 15:20:29 +01:00
Henning Stahlke
a199ca817c YASim: user Math functions in RigidBody 2017-12-15 15:20:29 +01:00
Henning Stahlke
abb451256d YASim CLI tool: add more CG outputs
remove non-significant digits from inertia printf()
2017-12-15 15:20:29 +01:00
Henning Stahlke
78f7950fa6 YASim: move common helper functions to new yasim-common.cpp 2017-12-15 15:20:28 +01:00
Henning Stahlke
c63ded1c44 YASIM add initialization
use Math::clamp in ControlMap
2017-12-15 15:20:28 +01:00
Henning Stahlke
b2000e1cca YASIM add a local var 2017-12-15 15:20:28 +01:00
Henning Stahlke
5aead123fc YASIM refactoring of ControlMap 2017-12-15 15:20:28 +01:00
Henning Stahlke
09c60ee40e YASIM add variable initialization 2017-12-15 15:20:28 +01:00
Henning Stahlke
3809137f7d YASIM add method multiplyLiftRatio to class Wing 2017-12-15 15:20:28 +01:00
Henning Stahlke
6feca92060 YASIM add struct StallParams to Wing 2017-12-15 15:20:27 +01:00
Henning Stahlke
b288ca3d9d YASIM: add struct Chord to Wing.hpp ; add static method calculateMAC to Wing 2017-12-15 15:20:27 +01:00
Henning Stahlke
6b473fde68 YASIM: move updating of model from Airplane to Wing 2017-12-15 15:20:27 +01:00
Henning Stahlke
fb6f965db7 YASIM: method name clarification (and indention) 2017-12-15 15:20:27 +01:00
Henning Stahlke
0e6552cddf YASIM: move property export code into classes (Wing) 2017-12-15 15:20:27 +01:00
Henning Stahlke
43af435085 YASIM: rename method getMAC to getMACLength 2017-12-15 15:20:27 +01:00
Henning Stahlke
c3bfeb4ba0 YASIM only reformat for better readability 2017-12-15 15:20:27 +01:00
Henning Stahlke
030403db5f YASIM member initialization in class Vector 2017-12-15 15:20:26 +01:00
Henning Stahlke
1194b09525 YASIM rename methods in class Surface 2017-12-15 15:20:26 +01:00
Henning Stahlke
1f721fb6d8 YASIM add new version tag for 2018.1 2017-12-15 15:20:26 +01:00
Henning Stahlke
77a9cca6d5 YASIM refactoring Wing class (flaps) 2017-12-15 15:20:26 +01:00
Henning Stahlke
95ee37c9b9 YASIM refactoring of Wing class 2017-12-15 15:20:26 +01:00
Henning Stahlke
3ac90ee866 YASIM: minor corrections and safeguards. 2017-12-15 15:20:26 +01:00
Henning Stahlke
ea8bfba98a YASim: add method to Wing and clarify member name. 2017-12-15 15:20:25 +01:00
Florent Rougon
c28f63132f Re-add airport(), navaid() and runway() methods of flightplan-leg ghosts
These methods were removed by mistake in commit 0dbb0dff9, which broke
code that relies on them (e.g., FMSDelegate.currentWaypointChanged() in
$FG_ROOT/Nasal/route_manager.nas).

Also remove 'waypointPrototype' from NasalPositioned.cxx, since it is
not used anymore.

Note: the methods can't be easily re-enabled by means of
      'waypointPrototype', because for FPLeg ghosts, 'waypointPrototype'
      was emulated as a parent class before this commit, and thus when
      querying an FPLeg ghost for its 'airport', 'runway' or 'navaid'
      member, the corresponding data member returned by
      waypointCommonGetMember() would be found by legGhostGetMember()
      *before* parent classes are searched. This commit prevents this
      from happening by returning 'airport', 'runway' and 'navaid' as
      member functions *directly* in legGhostGetMember(), before
      waypointCommonGetMember() is queried as a fallback.

Thanks to Eric van den Berg for the bug report.
2017-12-13 11:39:05 +01:00
Florent Rougon
b769ee6fdc AddonManager::registerAddonMetadata(): improve error messages 2017-12-10 22:41:03 +01:00
Florent Rougon
45867058f0 addon-metadata.xml: add meta section (non-leaf node) and file-type node
Move the format-version node inside /meta. It's not compatible of
course, but since the stuff this is breaking is only 2 or 3 days old,
let's go for it for nicer code and file format.

Sorry if you had already written an addon-metadata.xml file of your
own. In this case, just replace:

  <format-version type="int">1</format-version>

with:

  <meta>
    <file-type type="string">FlightGear add-on metadata</file-type>
    <format-version type="int">1</format-version>
  </meta>
2017-12-10 22:41:03 +01:00
James Turner
88940eb6bc Launcher: fix some warnings from QML 2017-12-09 09:46:14 +00:00
James Turner
58fa9fcaa7 Launcher: fix for unreliable aircraft-dir scanning 2017-12-09 09:32:25 +00:00
James Turner
d127a6ff9a Launcher: fix on-disk variant enumeration 2017-12-08 23:18:42 +00:00
Florent Rougon
3985bf4b19 Fix compilation error in src/Add-ons/AddonVersion.cxx
This should fix the following compilation error and other similar ones:

  converting to ‘std::tuple<flightgear::AddonVersionSuffixPrereleaseType,
  int, bool, int>’ from initializer list would use explicit constructor
  ‘constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&&
  ...)

According to <https://stackoverflow.com/a/32084829/4756009>, the change
wouldn't be needed in C++14 (and it built fine with my g++) but we use
C++11.
2017-12-08 18:39:27 +01:00
James Turner
e6e055dbb0 Launcher: preview image loading feedback
Expose the loading state as a property so the UI can show some feedback
when the image is still loading.
2017-12-08 16:14:47 +00:00
James Turner
033d5f65d5 Usability tweaks for editing ratings
Adjust ratings text now has mouse hover, and sliders can be clicked
on the track to adjust the value directly
2017-12-08 16:14:47 +00:00
Florent Rougon
48f52f14c4 Improved infrastructure for add-ons: C++ classes, metadata file, Nasal interface
This commit adds C++ classes for add-on management, most notably
AddonManager, Addon and AddonVersion. The AddonManager is used to
register add-ons. It relies on an std::map<std::string, AddonRef> to
hold the metadata of each registered add-on (keys of the std::map are
add-on identifiers, and AddonRef is currently SGSharedPtr<Addon>).
Accessor methods are available for:

  - retrieving the list of registered or loaded add-ons (terminology
    explained in $FG_ROOT/Docs/README.add-ons);

  - checking if a particular add-on has already been registered or
    loaded;

  - for each add-on, obtaining an Addon instance which can be queried
    for its name, id, version, base path, the minimum and maximum
    FlightGear versions it requires, its base node in the Property Tree,
    its order in the load sequence, short and long description strings,
    home page, etc.

The most important metadata is made accessible in the Property Tree
under /addons/by-id/<addon-id> and the property
/addons/by-id/<addon-id>/loaded can be checked or listened to, in
order to determine when a particular add-on is loaded. There is also a
Nasal interface to access add-on metadata in a convenient way.

In order to provide this metadata, each add-on must from now on have in
its base directory a file called 'addon-metadata.xml'.

All this is documented in much more detail in
$FG_ROOT/Docs/README.add-ons.

Mailing-list discussion:

  https://sourceforge.net/p/flightgear/mailman/message/36146017/
2017-12-08 00:36:41 +01:00
James Turner
ac50a3c7ed Restore OSG 3.2 compilation support 2017-12-05 21:39:30 +00:00
James Turner
3ffed7d867 Style singleton for the QML UI 2017-12-05 21:30:09 +00:00
James Turner
31c781257b Remove obsolete UI files 2017-12-04 22:34:39 +00:00
James Turner
d34edaa569 Pure QtQuick aircraft-UI
Moves previews, searching, rating handling and extended aircraft
information entirely into QQ. Many cosmetic tweaks and improvements
still to come.
2017-12-04 22:34:39 +00:00
James Turner
041b9527d3 Seperate aircraft cache from the model.
Allows exposing aircraft data to QML (via a helper object) outside the
context of the model.
2017-12-04 21:48:20 +00:00
James Turner
78950fea57 Fix crash on reset if terrasync is disabled
Also use C++11 iteration for group names in reset start code.
2017-12-04 21:41:05 +00:00
James Turner
5dcfdf593a Merge /u/sanhozay/flightgear/ branch sanhozay into next
https://sourceforge.net/p/flightgear/flightgear/merge-requests/101/
2017-11-27 17:09:04 +00:00
ThorstenB
147ff104cd Adds support for NMEA messages for traffic reporting (flarm). Also extends the NMEA base class to handle bidirectional communication. Allows FlightGear to feed position and traffic data (for multi-player and AI aircraft) to NAV/moving-map clients, like xcsoar, skydemon, skymap etc. Some basic flarm configuration commands are also emulated, to properly persuade the clients. By default, all moving aircraft are reported (traffic information). Actual threat-alerts are also supported, but require the installation of the "TCAS instrument". 2017-11-24 22:54:32 +01:00
Gijs de Rooy
8ca9dd89c9 QtLauncher: fix aircraft ratings
Index of rating indicators starts at 0 while ratings that correspond to a point/star/dot start at 1
2017-11-22 16:35:21 +01:00
ThorstenB
ad866afd81 Revised nmea and Garmin protocol classes.
The Garmin protocol implementation really is an NMEA protocol with a few
extra messages. Instead of duplicating the code, introduce the NMEA protocol
as a base class, which is reused for the Garmin class. The input/output
has not changed at all (and it maintains the FG-specific quirks, like our
NMEA class using LF-only linefeeds, while the Garmin protocol uses
CR-LF linefeeds.
2017-11-19 17:33:27 +01:00
ThorstenB
6ff4805361 TCAS: add default value when checking valid flag 2017-11-19 17:32:49 +01:00
ThorstenB
19b19f05bd Correct range checks for network protocol parameters.
Several checks were off by one, resulting in a segfault when only one
parameter was missing.
Also improve error messages, giving details about what is expected.
2017-11-19 17:30:12 +01:00
ThorstenB
27e2776890 Minor cleanup in parse_port_config. 2017-11-19 17:30:05 +01:00
Florent Rougon
94a8ba8f9b Add missing space in a log message 2017-11-19 11:14:51 +01:00
Florent Rougon
83fef08a04 Use common definition of simgear::enumValue() from <simgear/sg_inlines.h>
This avoids code duplication.
2017-11-19 08:23:14 +01:00
Florent Rougon
0537d569d5 Remove method FGAirport::isAirportType()
FGAirport::isAirportType() was redundant with
FGPositioned::isAirportType(). Remove the former and change existing
calls to use the latter.
2017-11-16 20:28:00 +01:00
Florent Rougon
a2254d891a Add missing include <algorithm> for std::max() and std::min()
<algorithm> was missing in src/AIModel/AIFlightPlanCreate.cxx and
src/Navaids/routePath.cxx. Thanks again to Alan Teeder for the reports!
2017-11-16 12:54:49 +01:00
Florent Rougon
0dbb0dff9e Three Nasal properties of waypoint objects now accessible: airport, runway, navaid
Waypoint objects used in Nasal code can now return their airport,
runway or navaid object (Nasal ghost). More precisely:
  - if waypoint 'wpt' was made from an airport object[1], then
    'wpt.airport' is this airport object;
  - if waypoint 'wpt' was made from a runway object[2], then
    'wpt.runway' is this runway object, and 'wpt.airport' is the
    airport containing that runway;
  - if waypoint 'wpt' was made from a navaid object[3], then
    'wpt.navaid' is this navaid object.

When one of the three properties 'airport', 'runway', and 'navaid' is
not applicable to a given waypoint due to the type of the underlying
FGPositioned, its value is nil.

The code for these properties was already mostly there, but
unreachable from Nasal.

[1] For instance, with createWPFrom(airportinfo("LOWI"))

[2] For instance, with createWPFrom(airportinfo("LOWI").runway("26"))

[3] For instance, with:

      var apt = airportinfo("LOWI");
      var navaid = findNavaidByFrequencyMHz(apt, 109.7);
      var navaidWpt = createWPFrom(navaid);
2017-11-16 11:22:39 +01:00
Florent Rougon
91470cbc54 Add FGPositioned static methods: isAirportType(), isRunwayType(), isNavaidType()
For consistency, define these three static methods in FGPositioned.
FGPositioned::isAirportType() is the same as FGAirport::isAirportType()
(piece of code moved from airport.cxx to positioned.cxx, and
FGAirport::isAirportType() now calls FGPositioned::isAirportType()).

- FGPositioned::isAirportType() returns true for AIRPORT, HELIPORT,
  SEAPORT;
- FGPositioned::isRunwayType() returns true for RUNWAY;
- FGPositioned::isNavaidType() returns true for NDB, VOR, ILS, LOC, GS,
  DME, TACAN.
2017-11-16 11:22:39 +01:00
Florent Rougon
9d4cbb005f Update header comment of src/Airports/airport.cxx 2017-11-16 11:22:39 +01:00
Florent Rougon
e68e73d252 Add missing include <algorithm> for std::max()
<algorithm> was missing in src/Instrumentation/airspeed_indicator.cxx
and src/Instrumentation/tacan.cxx. Thanks to Alan Teeder for the
reports.
2017-11-16 11:20:24 +01:00
James Turner
8fc04fdfb3 Fix Windows build for launcher changes 2017-11-15 22:04:03 +00:00
James Turner
2d663f2509 Fix crash with adding catalogs in the launcher
Change how we get notified about catalog changes, so we can remove
our hook and hence not leave a dangling pointer.

Fixes https://sourceforge.net/p/flightgear/codetickets/1994/
2017-11-15 21:46:57 +00:00
James Turner
7305b20483 Hopefully pacify GCC 4.8.x 2017-11-15 21:18:24 +00:00
James Turner
72ca36535a Fix the PUI map ruler feature, use right-click
The OSG Ctrl to right-click mapping was breaking this on Mac, but
changing that will break other things, so move the ruler feature from
‘ctrl left click’ to a simple ‘right click’ which ends up being the
same on Mac anyway.
2017-11-15 17:02:25 +00:00
James Turner
723e631f87 Restore PUI scrolling event behaviour
Fixes zooming in the map, for example.
2017-11-15 16:35:07 +00:00
James Turner
15fbf1f9cd Merge /u/thbr/flightgear/ branch next into next
https://sourceforge.net/p/flightgear/flightgear/merge-requests/106/
2017-11-15 08:01:07 +00:00
ThorstenB
cae4523d97 Completely removed obsolete debug code
as suggested by James.
2017-11-14 20:39:27 +01:00
ThorstenB
5f994c94b9 TCAS: do not process invalid AI models 2017-11-14 20:39:13 +01:00
James Turner
78bacefb60 Advanced weather support in the launcher 2017-11-14 17:54:22 +00:00
James Turner
daedf1e546 PUI dialog correct positioning on HiDPI displays
Apply the device-pixel-ratio when calculating the initial position of
PUI dialogs, so they appear correctly (eg, centered) when running with
device-pixel-ratio != 1.0
2017-11-14 17:30:31 +00:00
James Turner
b870b3f022 Fix wrong launcher aircraft name on startup
The mapping from aircraft URI to name was wrong for local (non-package)
aircraft, as spotted by Thorsten Renk. Note other data (thumbnail) is
still incorrect, but another change I have pending will replace this 
code anyway so only doing the simple fix for now.
2017-11-14 17:30:31 +00:00
ThorstenB
6077ef8cdd Remove unused copy&pasted nmea code from other protocol's source. 2017-11-13 20:40:41 +01:00
ThorstenB
f6ce434241 Disabled forgotten debug output. 2017-11-13 20:40:36 +01:00
ThorstenB
dd7d54cfcc Do not crash when specifying an unsupported transport medium for an I/O protocol. 2017-11-13 20:40:23 +01:00
Florent Rougon
2bf5a96aec Add two missing includes for <algorithm> 2017-11-13 15:58:08 +01:00
James Turner
20311c1956 Sorting parking candidates by size.
Ensures we only assign the smallest candidate parking, so tiny jets
don’t steal stands from A380s.
2017-11-02 17:21:27 +00:00
Erik Hofman
f13edf01fa Merge branch 'next' of ssh://git.code.sf.net/p/flightgear/flightgear into next 2017-10-31 10:54:21 +01:00
Erik Hofman
5f828894df Update to AeonWave version 3.0+ 2017-10-31 10:53:34 +01:00
James Turner
682c229313 Preserve loaded flight plan departure/arrival
When loading or cloning, don’t flag the departure and arrival as
changing, since this forces it to be discarded and rebuilt.
2017-10-29 14:00:59 +00:00
James Turner
ea31cb30e3 Change Nasal navaid searching API to handle units
Add explicit findNDBByFrequencyKHz, and rename the generic one to
explicitly use MHz, but exclude searching for NDBs.
2017-10-29 12:24:05 +00:00
Florent Rougon
86aaaf6de9 Process the --addon option in the standard way
Doing the option processing in Options::parseOption() has drawbacks:
  - doesn't work well upon reset;
  - doesn't work in the built-in launcher Additional Settings box.

Options::processOptions() is invoked both upon reset after the property
tree has been reset, and by the built-in launcher to process options
given in the Additional Settings box. This is not the case of
Options::parseOption() which is better for... parsing. :-)

Also use SGPath::fromLocal8Bit() to decode the path argument of --addon.
2017-10-23 09:18:51 +02:00
James Turner
e090427591 Better fix for CanvasWidget transparency
Use osg GLExtensions to retrieve glBlendFuncSeperate on Win32
2017-10-22 19:25:46 +01:00
Alessandro Menti
89ca665bfb
PUICamera Linux compilation fixes
* Correct the filename case in the #include directive in PUICamera.cxx,
  so that compilation succeeds on case-sensitive filesystems.
* Add the PU_SCROLL_UP_BUTTON and PU_SCROLL_DOWN_BUTTON #defines, as
  they are missing from some systems which ship old versions of the PUI
  library.
2017-10-21 11:20:07 +02:00
James Turner
c1df6e9d15 Hack to fix Windows build.
glBlendFuncSeperate will need some ugly trick to use in CanvasWidget, I better find another way.
2017-10-20 17:25:06 +01:00
James Turner
804dc4e74a Steps to make PUI optional, HiDPI tolerant.
Move all PUI event and rendering into a custom camera, which can be
rendered via an FBO to account for display-resolution scaling (HiDPI).

Start wrapping PUI calls in #ifdefs so PUI can be disabled at compile
time; a run-time switch is trivial now but not implemented yet.
2017-10-20 12:10:51 +01:00
Richard Harrison
9d590feaf3 Add support for fonts from the property tree for PUI dialog.
This permits, for example the following

		<font>
            <property>sim/gui/selected-style/fonts/nasal-editor</property>
		</font>
2017-10-15 21:50:41 +02:00
Richard Harrison
5af55a1409 Copy currently selected gui style tree to sim/gui/selected-style
This makes it considerably easier to reference an item from the currently selected style without having to lookup the selected style index and then use that to select the appropriate element from the styles/ tree
2017-10-15 21:49:40 +02:00
Stuart Buchanan
02ceb8832a Correct spacing of settings migration dialog 2017-10-13 17:36:20 +01:00
James Turner
2d5f56a05d Fix build with Qt < 5.6 2017-10-09 12:15:40 +01:00
James Turner
2e37fabd80 Fix crash with Qt < 5.9 in thumbnail items.
Qt 5.4, etc will work now
2017-10-09 10:37:50 +01:00
James Turner
907420d3f4 Windows / non-Qt build fixes 2017-10-05 15:02:30 +01:00
James Turner
e022e4fed5 Command / property bridges for QML / QtQuick 2017-10-05 12:38:27 +01:00
James Turner
2eab935dff Canvas proxy for QtQuick rendering
Has zero testing so far, still a work in progress.
2017-10-05 12:37:43 +01:00
James Turner
45cb6849b2 QtQuick drawable for OpenSceneGraph
Still work in progress, especially different threading modes are not
supported yet, and may crash doing QSG synchronisation.
2017-10-05 12:36:19 +01:00
James Turner
343fce4470 Improve mouse-warping with GraphicsWindowQt5 2017-10-03 08:21:15 +01:00
James Turner
b7a2e993b6 Fix crash in traffic code
Hit an exception where no runway node was found creating the landing taxi.
Probably should not happen but anyway let's not crash
2017-09-29 12:49:22 +01:00
James Turner
a4f1f8aca1 Fix error in setSpeed / setAltitude from Nasal
https://sourceforge.net/p/flightgear/codetickets/1992/
2017-09-29 12:39:30 +01:00
James Turner
386c13a84d Fix Windows compilation 2017-09-29 09:51:20 +01:00
James Turner
78d735a97b Fix Linux compilation 2017-09-28 15:49:42 +01:00
James Turner
4c4cfb3b44 Clean up CocoaMenuBar code
- remove use of Boost
- remove work-around for macOS < 10.7
2017-09-28 14:02:53 +01:00
James Turner
a89d747348 Unused include 2017-09-26 16:52:48 +01:00
James Turner
3b1b43f864 Include default airport in the location history
Only a quick hack, need to show more context to make this really
useful as a feature.
2017-09-26 16:52:48 +01:00
James Turner
06d206828a De-boost-ify position-init code
Also remove some now redundant parking-availability code, which is now
covered inside the dynamics code.
2017-09-26 16:52:48 +01:00
James Turner
a8e1fd4fd0 Move the user aircraft proxy into the AIManger
This should ensure there is always a proxy for the user in the AI
world for parking and ATC purposes.
2017-09-26 16:52:48 +01:00
James Turner
561e39e94f Quiet a log message. 2017-09-26 16:52:48 +01:00
James Turner
bb6510ad68 De-Boost-ify the AIManger, modernise to C++11 2017-09-26 16:52:48 +01:00
James Turner
972af3f254 Parking selection avoids AIObjects
This ensures AITraffic aircraft avoid parking stands occupied by
other AI objects, such as the user or MP aircraft
2017-09-26 16:52:48 +01:00
James Turner
c47325183c Simplify Qt version checks by requiring 5.4 2017-09-26 16:52:48 +01:00
James Turner
3a8d3506d6 Replace launcher aircraft list with QtQuick version
Improves various flow / layout / usability issues, since delegates
in ListView can do full event interaction.
2017-09-26 16:52:48 +01:00
James Turner
a005273724 Quiet a warning loading some ground-nets 2017-09-22 09:33:03 +01:00
James Turner
6db901a67f Add missing tr/qsTr wrappers to the launcher
Ensure all user-facing strings are annotated with translation macros,
so they can be translated soon.
2017-09-22 09:32:47 +01:00
James Turner
69934e04a6 Probably fix for Bug 1972 - AI parking positions
https://sourceforge.net/p/flightgear/codetickets/1972/
2017-09-21 18:37:43 +01:00
James Turner
66eb3d2690 Use a unique_ptr to manage FGAIFlightPlan 2017-09-21 18:37:14 +01:00
James Turner
c4aa3434ab Fix WS 2.0 paths to live inside a Terrain/ prefix 2017-09-21 17:48:30 +01:00
Florent Rougon
5fbf5fceab Fix build error in src/Main/test_autosaveMigration.cxx
The previous commit (32cc9be007) removed the second parameter of
FGGlobals::loadUserSettings(). Adapt testMigration() accordingly.
2017-09-20 22:19:01 +02:00
James Turner
32cc9be007 Enable auto-save migration.
When performing the migration, let the user know it happened, and to
be alert for any issues that might occur.
2017-09-20 17:57:25 +01:00
James Turner
c99504f321 Fix crash in Nasal _setChildren
We had a bit of stack smashing happening, fortunately the macOS runtime
is pretty good at detecting such things.
2017-09-19 08:20:08 +01:00
James Turner
351f6063c9 Permit more screenshots. (More than 1000) 2017-09-19 06:55:22 +01:00
James Turner
8e58c54544 Make routeRestrictionFromArg more robust. 2017-09-19 06:42:39 +01:00
James Turner
fba649a0e6 Fix crashes calling leg.setSpeed|Altitude(nil)
Treat passing nil as clearing the speed / altitude restriction for
the leg. Also default the second arg to ‘at’, so calling these
methods with a single numerical arg is permitted.
2017-09-19 06:36:32 +01:00
Torsten Dreyer
a82d955554 set fallback location to LKPR 2017-09-18 19:55:10 +02:00
James Turner
1b8d0fb277 Nasal FlightPlan insertWp[After] return the leg. 2017-09-11 23:43:59 +01:00
James Turner
b0de9d5a11 Make Nasal Flightplan.indexOfWP work on Legs 2017-09-11 23:30:53 +01:00
James Turner
2acf2aa5ba Saving flightplans from Nasal.
Usage:

var fp0 = flightplan();
fp0.save("p6.xml");
2017-09-11 23:24:25 +01:00
James Turner
ddea3929f8 Fix clearing FlightPlan elements from Nasal.
Clearing the departure or destination elements, including the SID,
STAR or approach to nil, now works, e.g:

var fp = flightplan();
fp.departure = nil;
2017-09-11 23:24:24 +01:00
James Turner
194d17ec94 Add createFlightplan Nasal hook
Allows creating a new, inactive by empty Flightplan from Nasal. Can
also be used to load a flightplan:

var fp1 = createFlightplan();
var fp2 = createFlightplan("p3.xml");
2017-09-11 23:24:24 +01:00
James Turner
ca067b1a82 Fix Nasal owning of FlightPlans
Also refactor delegate ownership to be flat instead of nested, much
easier as the number of delegates has grown.
2017-09-11 23:24:24 +01:00
James Turner
d422992b2d Re-indent my fix from yesterday to 2-space mode.
This will fix a misleading indentation warning from GCC, although to
doubly sure I also added explicit braces to the code.
2017-09-09 19:03:53 +01:00
James Turner
bf2c363e50 Fix carrier starts
Rewrite the position-init code for carrier starts, to precisely wait
on the carrier model being loaded, before proceeding with FDM init.
This allows the FDM to see the correct carrier model in the ground
cache, and hence avoids starting in the water.

To implement this, the CheckSceneryVisitor is used to force the carrier
model to be loaded while the splash-screen is visible.
2017-09-08 22:31:22 +01:00
James Turner
91d3229514 Catch large ground-cache requests.
In some testing, JSBsim sometimes passed extremely large values into
this function (larger than the radius of the earth). This causes
every tile on the planet to be scheduled if using the standard STG
terrain, effectively blocking startup.

This code allows us a chance to catch this case via logging, but does
not fix the underlying issues.
2017-09-04 22:48:38 +01:00
James Turner
657f811548 Activating a FlightPlan sets it on the route-mgr
This enables the Route-manager FP to be replaced from Nasal, as well as
via the load-route command.
2017-09-04 22:48:38 +01:00
Richard Harrison
5f3e4bdde7 Fix for the pilot list (and possibly other things) that fail with the new _setValues API.
The problem is that the two aren't functionally equivalent; the Nasal version would fail silently - whereas the new C++ version gave a runtime error.

The immediate fix is therefore to simply remove the runtime error.
2017-08-30 22:19:01 +02:00
James Turner
b6bfe45759 Change how anti-aliasing is requested by the launcher.
This seems to fix https://sourceforge.net/p/flightgear/codetickets/1971/ 
for me, but I have some reservations about my testing of this, so
pushing this change to get wider feedback.
2017-08-29 14:22:32 +01:00
Florent Rougon
30aebc783b FGLogger::Log: use std::unique_ptr to manage the sg_ofstream instance
No more raw pointer; RAII is good.
2017-08-27 16:13:01 +02:00
Florent Rougon
b56f694ffd FGLogger: fix error handling when file opening fails; modernize and simplify
The bug fix is:

-    if (!log.output) {
+    if ( !(*log.output) ) {

(i.e., testing the sg_ofstream instance instead of its address) and then
ensuring that the corresponding Log instance is removed from _logs and
destroyed.

The "destroy" part is made automatic by using std::unique_ptr instead of
raw pointers. This allows to simplify several areas of the code.

Don't provide custom definitions for the constructor and destructor of
FGLogger anymore, now that they don't need to do anything: IIRC, this
allows compilers to do some optimizations according to the C++ standard.
2017-08-27 16:13:01 +02:00
Florent Rougon
2a5e3d06b2 Security: don't allow FGLogger to overwrite arbitrary files
Since the paths of files overwritten by FGLogger come from the property
tree[1], they must be validated before we decide to write to these
files.

[1] Except for the "empty" case, which uses the default name
    'fg_log.csv'. This file is deemed acceptable to overwrite in the
    current directory, as the name is completely fixed and clearly
    FG-specific.
2017-08-27 16:09:18 +02:00
Florent Rougon
c7a2aef599 Call fgInitAllowedPaths() earlier: after Options::processOptions()
Call fgInitAllowedPaths() right after Options::processOptions() (which,
among other things, determines $FG_ROOT and processes
--allow-nasal-read). This way, fgInitAllowedPaths() can be used in much
more code, such as when initializing subsystems.
2017-08-27 16:07:51 +02:00
Florent Rougon
41045f3bf3 Remove XLIFF files from this repository
It was finally decided that the XLIFF files will live in FGData (cf.
<https://sourceforge.net/p/flightgear/mailman/message/35996085/> and
earlier messages in the same thread).
2017-08-18 11:22:47 +02:00
Stuart Buchanan
386f8b87b5 C++ versions of props.nas setValues/setChildren()
Improve performance of Nasal properties access
by implementing the setValues/setChildren props.nas
functions in C++.  Naive implementation effectively
copying the Nasal versions verbatim.

However, on a test suite writing 1000 Canvas paths,
results in a 50% reduction in runtime, and significant
reductions in memory occupancy.

On a much larger task (5500 paths) results in a 30%
reduction, probably due to Nasal GC.
2017-08-06 21:13:15 +01:00
Florent Rougon
553212df1a fgrcc: use correct C++ variable names in generated C++ files
Use base 26 numbering with letter-only digits for resource indices in
the C++ files generated by fgrcc. This is needed because, for instance,
'resource10' appears not to be a valid C++ variable name, mpfff...
2017-08-03 11:14:19 +02:00
Florent Rougon
9c0dee2e9f Add XLIFF 1.2 translation files and register them as embedded resources
Translations/en_US/FlightGear-nonQt.xlf is for a proper English
translation, where for instance "found %n airport(s)" would have two
plural forms, "found %n airport" and "found %n airports" (most
non-plural strings can be taken verbatim from the default translation,
and at this point there is no plural form at all yet).

As they are registered here, the files will have virtual paths such as:

  /Translations/de/FlightGear-nonQt.xlf
  /Translations/en_US/FlightGear-nonQt.xlf
  etc.

for the EmbeddedResourceManager ('/' being the default virtual prefix).
2017-08-01 09:38:44 +02:00
James Turner
c000f1fb43 Fix back-slashes in quoted args in the launcher
Logic was messed up, back-slashed got ignored due to the
escaping logic.
2017-07-25 10:00:31 +01:00
Richard Harrison
f507ca1452 Animation bindings: fix bug with specified index on bindings
This is a fault that I introduced with the bindings rework - by adding the index of 0 to the get prop it overrides the index in the parameter.
2017-07-23 13:41:56 +02:00
James Turner
b19fe7be7d Make some AI-traffic warnings DEV_WARN
This reduces the log noise in release builds, relating to AI ground-nets
with incomplete data, especially the commonly occurring ‘gate XYZ
doesn’t seem to have any routes associated with it’ message.

https://sourceforge.net/p/flightgear/codetickets/1974/
2017-07-20 18:00:49 +01:00
James Turner
5ba953ad61 Fix custom download-dir in launcher
Updating the value takes immediately, as it did in 2017.1 and prior.
Additionally, passing —download-dir on the command-line is detected
and handled specially; the UI option is disabled, and no changes are
made to the value passed in. (The launcher does not override the value
with any value it has saved)
2017-07-19 19:24:33 +01:00
James Turner
8fdb56a185 Only qInfo was added in 5.5
Other logging operators are present in 5.0, so simplify this code.
2017-07-19 13:21:06 +01:00
Torsten Dreyer
f6698a0b1f Introduce commandline-option --addon
using  --addon=/foo/bar does
 * add /foo/bar/config.xml as propertyfile
 * add /foo/bar to aircraft_paths to provide read-access
 * sets property /addons/addon[n]/path = "/foo/bar"
 * addons get initialized from addons.nas in FGDATA/Nasal
2017-07-18 12:13:44 +02:00
Torsten Dreyer
c9eff67409 Hopefully fix "qInfo not defined" 2017-07-07 11:50:06 +02:00
Torsten Dreyer
169b0f59e5 Use SGMisc wrapper for _isnan makes "other" OSes happy 2017-07-07 09:12:16 +02:00
Richard Harrison
2c8aad12ba Model relative property tree root binding.
Change fgcommand to take an optional property tree root element.

This fixes the animation bindings to use the defined property tree root - to support multiplayer (or other) model that can bind to the correct part of the property tree.

Requires a corresponding fix in sg to allow the command methods to take an optional root parameter.

What this means is that when inside someone else's multiplayer model (e.g. backseat, or co-pilot), the multipalyer (AI) model will correctly modify properties inside the correct part of the property tree inside (/ai), rather than modifying the properties inside the same part of the tree as the non-ai model.

This means that a properly setup model will operate within it's own space in the property tree; and permit more generic multiplayer code to be written.

This is probably responsible for some of the pollution of the root property tree with MP aircraft properties.
2017-07-05 11:37:17 +02:00
Richard Senior
ef6af467ed Add airspeed and ground bit to MP protocol for Mode-S transponders
Ground-bit is set manually (via the transponder GND knob position) or
automatically using a property referenced in instrumentation.xml.

Aircraft will only transmit these new properties when using the
multiplayer v2 protocol.
2017-06-27 16:04:30 +01:00
James Turner
ec1990907e Non-launcher parts of minimum-fg-version support
This adds console and message-box warnings, based upon aircraft
declaring the minimum FG version they support. A follow-up commit
will extend the launcher UI to warn the user about this in a nicer
way.
2017-06-22 00:22:18 +01:00
James Turner
aef9bc4e06 Launcher: more robust preview downloading.
Tolerate download failures, which seem to happen due to Ibiblio rate-
limiting, more gracefully.
2017-06-21 23:50:04 +01:00
James Turner
67dfff9a84 Fix for build with Qt 5.2 2017-06-19 19:32:15 +01:00
James Turner
af6611d7f6 Initial attempt at —-uninstall mode for FGFS
This is a headless mode, designed to be invoked from an installer, not
used directly by users. It doesn’t touch the ‘normal’ installation, but
rather removes the other files FG typically creates or downloads.
2017-06-15 18:30:37 +01:00
Florent Rougon
0855f0414f Tentative fix for the MSVC build
When building with MSVC, use the CMAKE_MSVCIDE_RUN_PATH variable to
prepend ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/bin to the PATH in
order to (hopefully) allow fgrcc to find the libraries it needs. We may
need to add something similar for SimGear---will see.

The use of CMAKE_MSVCIDE_RUN_PATH and other ways to address this problem
are discussed at
<https://stackoverflow.com/questions/28533012/how-to-set-runtime-path-for-cmake-custom-command-on-windows>.
2017-06-13 17:58:21 +02:00
James Turner
f55fd3f10c Compat fixes for older Qt versions. 2017-06-11 23:15:52 +01:00
James Turner
9031182583 GraphicsWindowQt5: improved keyboard + modifiers
This fixes many kinds of input weirdness, caused by ‘stuck’ modifiers
being set internally, and causing input bindings to be excluded.
2017-06-11 23:11:33 +01:00
Florent Rougon
b2cc191bc6 Integrate the EmbeddedResourceManager into FlightGear
${CMAKE_SOURCE_DIR}/src/EmbeddedResources/FlightGear-resources.xml
(currently empty) is automatically "compiled" into
${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.[ch]xx by
fgrcc inside the build directory. These files are incorporated into the
FlightGear build (FlightGear-resources.cxx is linked into FlightGear).

When the XML embedded resource declaration file added here,
FlightGear-resources.xml, is compiled, fgrcc is passed the
--root=${CMAKE_SOURCE_DIR} option, so that files referred to in
FlightGear-resources.xml are looked up relatively to the root directory
of the FlightGear repository. One could use a second XML embedded
resource declaration file compiled with a different --root option to
grab files from FGData, for instance. I would name such a file
FGData-resources.xml to be consistent with the current naming scheme.

Note: this --root option applies to the paths of real files. Don't
      confuse it with the 'prefix' attribute of <qresource> elements
      inside XML resource declaration files (such as
      FlightGear-resources.xml), which applies to the virtual path of
      each resource defined beneath.

The commands in src/Main/CMakeLists.txt ensure that
FlightGear-resources.xml is recompiled with fgrcc whenever it is
changed, and obviously also when FlightGear-resources.cxx or
FlightGear-resources.hxx is missing. However, CMake doesn't know how to
parse fgrcc XML resource declaration files, therefore when a resource is
modified but the XML file it is declared in is not (here,
FlightGear-resources.xml), you have to trigger yourself a recompilation
of the XML resource declaration file to see the new resource contents
inside FlightGear. The easiest ways to do so are:
  - either update the timestamp of the XML resource declaration file;
  - or remove one or both of the generated files
    (FlightGear-resources.cxx and FlightGear-resources.hxx here).

The EmbeddedResourceManager is created in fgMainInit() just after
Options::processOptions() set the language that was either requested by
the user or obtained from the system (locales). Resources from
FlightGear-resources.cxx are added to it, after which
EmbeddedResourceManager::selectLocale() is called with the user's
preferred locale (obtained with FGLocale::getPreferredLanguage()).

Upon reset (fgStartNewReset()), EmbeddedResourceManager::selectLocale()
is called in a similar way after Options::processOptions(), however in
this case the EmbeddedResourceManager instance doesn't have to be
recreated.
2017-06-11 18:57:58 +02:00
Florent Rougon
acb5650b83 Minor changes in locale.cxx and locale.hxx
- remove use of boost in src/Main/locale.cxx;
- add missing header <cstring> for std::strlen();
- replace NULL with nullptr;
- fix some broken indentation;
- other small readability improvements.
2017-06-11 18:57:58 +02:00
Florent Rougon
905e1973eb Add method FGLocale::getPreferredLanguage()
This function returns the preferred "locale"[1] according to user choice
and/or settings (i.e., it is influenced by --language if passed,
otherwise by current locale/system settings). The return value never has
an encoding part. It is the empty string if nothing could be found,
otherwise should look like fr_BE or it_IT.

[1] "language" term used in the function name for consistency with the
    existing and related FGLocale::selectLanguage().
2017-06-11 18:57:58 +02:00
Florent Rougon
1bf3aee5df Make the Unix impl. of FGLocale::getUserLanguage() consistent with the others
Windows and Mac implementations return a string without any encoding
specifier -> remove this specifier directly in the Unix/Linux
implementation for consistency.

Also do some small refactoring with the new static method
FGLocale::removeEncodingPart(). Slight difference with the previous
algorithm: if a '.' is found in the given locale spec, we assert() that
it is not the first character. The previous code in
FGLocale::findLocaleNode() used to consider such weird locale specs
starting with a dot as normal locale specs without any encoding part.

Note: the same change could be done where FGLocale::findLocaleNode()
      looks for an underscore in order to prepare for the fallback
      search (e.g., 'fr' after not finding translations for 'fr_FR').
2017-06-11 18:57:58 +02:00
Florent Rougon
ed9f985f92 Fix warnings in fgrcc.cxx
The braces fix is apparently needed to avoid warnings due to a compiler
bug, or at least missing feature (cf. [1] and [2]). The other one in
std::accumulate() seems legitimate.

[1] http://en.cppreference.com/w/cpp/container/array
[2] https://stackoverflow.com/questions/14178264/c11-correct-stdarray-initialization
2017-06-11 18:52:45 +02:00
Florent Rougon
42821d6a63 Embedded resources: add a resource compiler (fgrcc)
For more info, run 'fgrcc --help' and/or read the presentation at [1]
(will be probably added to $FG_ROOT/Docs at some later point).

[1] https://sourceforge.net/p/flightgear/mailman/message/35870025/
2017-06-11 17:46:32 +02:00
Bertrand Coconnier
b76db7737d Added the generation of wake induced force and moment for JSBSim models.
The wake induced force and moment are computed as an external reaction to the JSBSim model. For these force and moment to be accounted for by JSBSim, the following external reaction needs to be added to FDM XML definition:
<external reaction>
  <force name="ai-wake">
    ...
  </force>
  <moment name="ai-wake">
    ...
  </moment>
</external reaction>

This is similar to how the hook and wire feature is modeled in JSBSim.
2017-06-10 23:27:52 +02:00
James Turner
aaddfdcea7 Different work-around for Qt < 5.5 2017-06-10 21:57:53 +01:00
Bertrand Coconnier
96df6689e6 Added the computation of the wake of all AI aircrafts.
Wake computations are now performed for all AI aircrafts within a range lower or equal to the value indicated by the property /fdm/ai-wake/max-radius-nm.

These computations are triggered by the property /fdm/ai-wake/enabled (it is disabled by default).

The result of the wake computations is not yet used by the FDMs so do not expect the user aircraft to react to the AI wake.
2017-06-10 21:13:20 +02:00
Bertrand Coconnier
b5fe38c1eb Compile AI wake numerical core in FG main executable.
AI wake code is still dead code except that it is now compiled with FG.

Input data for wake computations are extracted from the performance database. The data must be specified as follows (values are for illustration only) :
<geometry>
  <wing>
    <span-ft> 100. </span-ft>
    <chord-ft> 12. <chord-ft>
  </wing>
  <weight-lbs> 90000. </weight-lbs>
</geometry>
2017-06-10 20:19:43 +02:00
Bertrand Coconnier
cdf299391d Added missing <cmath> header for Mac to compile. 2017-06-10 19:22:15 +02:00
Bertrand Coconnier
c1313f2ecb Added the core of the AI wake computations with its tests.
At the moment, this is dead code: only the tests are compiled. FG is still compiled without this code.

A new directory is created that contains all the numerical computations made to estimate the wake induced by AI aircrafts. This is based on the venerable Vortex Lattice Method (VLM) which was all the rage in the 60's Computational Fluid Dynamics (CFD).

Even though quite old, the method is relevant to compute aircrafts wake in real time since 3D Navier-Stokes (NS3D) is out of reach for real time computations even with modern multicore personal computers and their GPUs.
2017-06-10 18:27:19 +02:00
Bertrand Coconnier
8667300483 Added missing header <memory> for Linux. 2017-06-10 18:03:03 +02:00
James Turner
b309b8a7ac Fix compilation with older OSG / Qt 2017-06-10 15:59:37 +01:00
James Turner
5e04aab318 QtGraphicsWindow: Remove deferred event support.
No longer needed, since we are using windows, not a widget.
2017-06-10 15:49:09 +01:00
James Turner
09972be25a Expose device-pixel-ratio to properties.
This allows scaling of the UI accordingly, to keep things usable on
HiDPi screens. (Note this is not fixed yet, but this is a step)
2017-06-10 15:48:11 +01:00
James Turner
4d900a5c26 Strong and stable ownership of the window, context
Use owning pointers in GraphicsWinQt to own the GLwindow and QOGLContext,
so shutdown is more orderly, especially when driven from the OSG or
window-manager, as opposed to an ‘internal’ quit.
2017-06-10 15:46:16 +01:00
Bertrand Coconnier
34a0c6c2a8 Make some methods public for the AI wake feature.
In order to compute the AI aircrafts wake, the FDM will need access to the list of AI aircrafts as well as being able to compute their range to discard aircrafts which are too far.
2017-06-10 15:28:28 +02:00
James Turner
40cc4cc02c Let Qt pick the default window position.
(For GraphicsWindowQt5 only)
2017-06-08 15:18:23 +01:00
James Turner
bafcf2de38 GraphicsWinQt toggles fullscreen natively.
This also improves handling when starting full-screen, and keeps the
window and internal state in sync.
2017-06-08 14:51:38 +01:00
James Turner
0c59583b32 Fix intermittent crash on exit with Qt+XCB
We can still crash on exit(-1) code paths since we can’t run this from
atexit, but at least the non-error paths are ok.
2017-06-07 17:52:47 +01:00
Florent Rougon
889c1bf0cb Remove alignLocaliserWithRunway(): deemed to be a "misfeature" :-)
In the thread at
<https://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/87tw7sm5uw.fsf%40frougon.crabdance.com/#msg35673402>,
it was decided that alignLocaliserWithRunway() was a bad idea overall,
and should just be removed. The feature was already disabled by default
in recent releases via defaults.xml (since FlightGear 2017.1, precisely
FGData commit ea76305e42fd245e79a2b5bb569c8c61161f5721). Remove the code
entirely now.

The properties /sim/navdb/localizers/auto-align and
/sim/navdb/localizers/auto-align-threshold-deg have no effect anymore,
you may remove them from your configs if you somehow set them.

This goes with FGData commit 6dd9f6e8d962b00a1ccddc6af487c404cc935b92.

In case someone wanted to reuse the removed code, please consider
Szymon's proposed change at
<https://sourceforge.net/p/flightgear/flightgear/merge-requests/76/>,
which was:

,----
| Fixed bug in alignLocaliserWithRunway when building NavCacheDb
|
| The position of the localizer was converted to a distance from
| the displaced threshold, and then back to the posistion on the
| centerline, but the origin of the second computation was
| non-displaced threshold.
|
| --- a/src/Navaids/navdb.cxx
| +++ b/src/Navaids/navdb.cxx
| @@ -104,8 +104,8 @@
|  void alignLocaliserWithRunway(FGRunway* rwy, const string& ident, SGGeod& pos, double& heading)
|  {
|    assert(rwy);
| -  // find the distance from the threshold to the localizer
| -  double dist = SGGeodesy::distanceM(pos, rwy->threshold());
| +  // find the distance from the (non-displaced) threshold to the localizer
| +  double dist = SGGeodesy::distanceM(pos, rwy->geod());
|
|    // back project that distance along the runway center line
|    SGGeod newPos = rwy->pointOnCenterline(dist);
`----
2017-06-07 14:03:32 +02:00
James Turner
444864c7ba GraphicsWindow using Qt5, work-in-progress.
Enable by setting:
	/sim/rendering/graphics-window-qt=1

Known issues with HiDPI scaling of PUI & Canvas, and probably many
other issues besides.
2017-06-07 08:23:17 +01:00
James Turner
8bad6f11e5 Merge /u/elgaton/flightgear/ branch disable-deprecated-enhanced-lighting-and-adf into next
https://sourceforge.net/p/flightgear/flightgear/merge-requests/99/
2017-06-06 12:10:35 +00:00
Bertrand Coconnier
1a0e5a20ae Fixed LaRCSim matrix computation routines.
There was a couple of typos in the routine. This code will be used by the AI wake feature.
Also added a test for the matrix code to make sure they will be no regression.
2017-06-05 17:18:52 +02:00
Bertrand Coconnier
7d80a48d94 Sync. w/ JSBSim
External moments can now be specified in addition to external forces. This feature is needed for the AI wakes.
Headers clean up to reduce the amount of recompilation when modifying an header file.
2017-06-05 13:09:00 +02:00
Alessandro Menti
7245357751
Mark enhanced lighting options and --adf as deprecated
Print an error message and exit if --{enable,disable}-enhanced-lighting
or --adf are used (those deprecated options will be removed in a future
version of FlightGear).
2017-06-04 16:56:17 +02:00
Richard Harrison
ac89ec94a3 Console: restore option to open console early. 2017-05-31 11:38:13 +02:00
Richard Harrison
16a7493de7 Fix --console from the launcher 2017-05-30 17:59:34 +02:00
James Turner
7951abefe2 Auto-select built-in FGdata when possible.
As spotted by Thorsten, reduce user annoyance by asking about FGData
when the built-in data is acceptable. (Advanced users can use the
launcher or other options to change FGdata as normal).
2017-05-30 10:02:41 +01:00
Edward d'Auvergne
d2a6eb69a5 Clean up of the Ephemeris class members, removing the raw pointers.
The property nodes have been switched to SGPropertyNode_ptr and _impl to std::unique_ptr.
2017-05-30 09:57:37 +02:00
Edward d'Auvergne
a0dc7b5ba3 Untied the /environment/moonlight property. 2017-05-29 09:47:31 +02:00
Bertrand Coconnier
24a148880c Fixes to the trim on ground feature.
* Skip the gears when located over water. They will be skipped by the ground reactions anyway making the trim irrelevant.
* Ignore the ground bumpiness during the trim. The trim algorithm seems not to
be robust enough to handle that. This does not make much difference to the
converged solution anyway since the bumpiness is generally low.
* Fixed the WOW status for contacts over water (was 'false' is now 'true').
* All the gear/contact data are now properly reset when WOW==false. The reset
code is now common to all the case where WOW is false.
2017-05-28 20:14:33 +02:00
Bertrand Coconnier
76ef08679d Cleaned up the JSBSim interface. 2017-05-28 20:12:30 +02:00
James Turner
eb5d482ded Use GetUserDefaultLocaleName
This should improve our locale detection on Windows, since it is the recommended
solution according to MSDN.
2017-05-22 17:50:50 +01:00
James Turner
27b34182c7 Launcher: Enable DPI-scaling
(for Windows especially)
2017-05-22 08:53:27 +01:00
James Turner
15c84139fa Fix launcher failure with custom MP server
When the user specified an MP server without providing a port, the
launcher would pass a malformed command line, leading the the simulator
bailing out. 

(Should go to the release branch)
2017-05-22 08:53:27 +01:00
James Turner
18b8b59af6 Validate MP callsign with a reg-exp 2017-05-22 08:53:27 +01:00
James Turner
42508619ee Validation of METAR in the launcher 2017-05-22 08:53:27 +01:00
Richard Harrison
0c4eaa8b29 Canvas exception during re-init.
Add defensive logic to ensure that a null pointer isn't dereferenced. This happened to me once or twice during a reinit (Location/Position In Air to the current position). It may be related to the model, but in any case the code needs to ensure that the static cast failure is handled correctly.
2017-05-20 13:40:02 +02:00
Richard Harrison
ee951c00e7 2017.2 Multiplayer compatibility fixes
2017.2 in compatible mode was not compatible with 2017.1.x because the V1 packet had V2 properties in it; the protocol version and the new launchbar encoding - both of which should not be transmitted. This only affected 2017.1 because it discards the rest of the packet once an unknown property is encountered (to increase reliability).
2017-05-20 13:32:03 +02:00
Richard Harrison
ffde50484c Added support for multiplay/generic/bool[0..90] packed into three ints of 31 bits.
Add support for per property encoding.
- encode_for_transmit  - method that will convert from and to the packet for the value.
- decode_received - decodes received data
2017-05-18 00:15:59 +02:00
Torsten Dreyer
406f158067 Change fallback airport to KBOS 2017-05-17 22:34:38 +02:00
James Turner
e288ff7fe2 Use osg::createTexturedQuadGeometry
Simplifies splash screen code slightly.
2017-05-16 17:14:08 +01:00
James Turner
3c8bedb9c3 Make launcher summary version dynamic. 2017-05-16 13:25:51 +01:00
Florent Rougon
4b48aca411 Rename flightgear.desktop to org.flightgear.FlightGear.desktop; improve it
This closes ticket #1961
(<https://sourceforge.net/p/flightgear/codetickets/1961/>). To be sure
the file is found, call app->setDesktopFileName() in
src/GUI/QtLauncher.cxx if the Qt version is 5.7 or later.

See <https://sourceforge.net/p/flightgear/mailman/message/35840997/> and
<https://sourceforge.net/p/flightgear/mailman/message/35841007/> for the
small changes to the desktop file contents.
2017-05-16 13:58:37 +02:00
Florent Rougon
034fb89db3 Abort with a clear error message for invalid uses of --config inside a config file
The options.cxx code is not ready to handle recursive use of --config
(for config files). Instead of failing in an ugly way, abort with a
clear error message in such situations. See discussion at
<https://sourceforge.net/p/flightgear/mailman/message/35838852/>.

Note: it *is* possible to load XML PropertyList files from config files,
      so --config is not entirely "banned" from config files.

+ add missing include
2017-05-15 11:06:47 +02:00
Florent Rougon
6ef8b5bf94 Qt launcher: more spelling fixes 2017-05-13 17:17:32 +02:00
Alessandro Menti
42495e3251
Qt launcher: spelling fixes 2017-05-13 10:24:17 +02:00
James Turner
327f59a105 Fix new splash screen with Rembrandt enabled
Stray depth-test state was causing the splash quad to be discarded.
2017-05-11 23:02:40 +01:00
Rebecca N. Palmer
faf872e7f7 RouteMgr security: don't allow overwriting arbitrary files
(the previous fix 280cd523 missed commandSaveFlightPlan)
2017-05-11 22:21:20 +01:00
Richard Harrison
b80b9a8fc0 Added Nasal methods for ground intersection test and aircraft coordinate conversion
New Nasal method get_cart_ground_intersection

Returns where the given position in the specified direction will intersect with the ground. Returns whether or not a certain position and direction pair intersect with the ground, and if so the intersection point.

Useful for radars, terrain avoidance (GPWS), etc.

Input parameters:
1. vec3d(x,y,z) position
2. vec3d(x,y,z) direction

Returns nil or geod hash (lat:rad,lon:rad,elevation:Meters) intersection

Example Usage:

var end = geo.Coord.new(start);
end.apply_course_distance(heading, speed_horz_fps*FT2M);
end.set_alt(end.alt() - speed_down_fps*FT2M);

var dir_x = end.x() - start.x();
var dir_y = end.y() - start.y();
var dir_z = end.z() - start.z();
var xyz = { "x":start.x(),  "y" : start.y(),  "z" : start.z() };
var dir = { "x":dir_x,      "y" : dir_y,      "z" : dir_z };

var geod = get_cart_ground_intersection(xyz, dir);
if (geod != nil) {
         end.set_latlon(geod.lat, geod.lon, geod.elevation);
          var dist = start.direct_distance_to(end)*M2FT;
         var time = dist / speed_fps;
         setprop("/sim/model/radar/time-until-impact", time);
     }

-----------

Nasal method aircraftToCart : This allows easily computing offsets in aircraft-relative coordinates, and converting to global cartesian (ECEF) reference frame.
2017-05-11 20:05:14 +02:00
Florent Rougon
fd78d32e56 End segfault_handler() with std::abort() rather than kill() on ourselves
This has the advantage, according to my testing on Linux, that core
files obtained after a crash now point to the crashing thread again,
when one starts 'gdb' on the core file and runs the 'bt' command.

Apparently, when using kill(), the signal is seen as coming from the
outside and gdb's 'bt' command points to the wrong thread in general
when debugging using a core file (when debugging "live", gdb intercepts
the signal even before FG's signal handler is started).

See discussion starting at
<https://sourceforge.net/p/flightgear/mailman/message/35833221/>.
2017-05-11 12:19:31 +02:00
James Turner
00845b17b9 Prevent PUI menubar obscuring startup tips
Add an additional visibility flag to the menubar implementations, 
conditional on whether or not the menubar overlaps the window content.
(I.e for PUI but not Cocoa). This flag is linked to a new property
/sim/menubar/overlap-hide, which the renderer drives off the splash-
screen visibility.
2017-05-11 08:39:48 +01:00
Florent Rougon
4dc2e4fc09 Disable use of the WindowsFileDialog class
On Windows, use:
  - QtFileDialog if FG was built with Qt support;
  - PUIFileDialog otherwise.

Behavior on other platforms is unchanged. This change is motivated by
the fact that some Windows users have reported[1][2] weird,
non-deterministic behavior of WindowsFileDialog and unfortunately, no
one seems to be willing and able to fix the problem. The Qt
implementation comes for free and should be quite robust. Of course, if
someone wants to maintain the WindowsFileDialog class again, the change
can be reverted.

See discussion at [3].

[1] https://forum.flightgear.org/viewtopic.php?f=25&t=31945
[2] https://sourceforge.net/p/flightgear/mailman/message/35761650/
[3] https://sourceforge.net/p/flightgear/mailman/message/35759819/
2017-05-11 00:12:20 +02:00
Florent Rougon
7f59846644 Splash screen: support text encoded in UTF-8
This fixes handling of non-ASCII splashscreen text for me (Debian
GNU/Linux). The XML input files don't technically *have* to be encoded
in UTF-8, as long as they properly declare the encoding and it is
supported by Expat. Of course, we prefer UTF-8 nowadays.

With this commit, startup tips and splash screen progress strings
("Loading scenery", "Initializing subsystems", etc.) can at last be
written correctly in languages that need non-ASCII characters.

The Expat doc is unfortunately unclear on its *output* encoding, saying
the following (expat.h):

  The characters are passed exactly as they were in the XML document
  except that they will be encoded in UTF-8 or UTF-16.

The only relevant header I can see in SimGear is
3rdparty/expat/sg_expat_external.h, which has interesting stuff around
XML_UNICODE, however it doesn't seem to take position.

I fear that whether UTF-8 or UTF-16 is used for Expat's output (and thus
for what easyxml.cxx gives us) depends on how it was compiled. Let's
hope everyone has it compiled for UTF-8 output...
2017-05-10 16:59:29 +02:00
Florent Rougon
33c54e5d76 Fix crash in PT_vs_hpt() due to invalid data in ISA_def
In commit 15525aab58, a layer with
lapse=0.0 was added to ISA_def (atmosphere model). However, the last
layer *must* have lapse == -1.0, otherwise the code in PT_vs_hpt()
doesn't know when it's on the last element of ISA_def, and does an
illegal memory access with (pp+1)->height. This is why -1.0 is the
default value for lapse ('l') in the ISA_layer constructor.

Fix: add the -1.0 terminator to the last element of ISA_def.
2017-05-10 16:54:55 +02:00
Florent Rougon
9a64150d57 Fix crash in src/ATC/trafficcontrol.cxx (invalid iterator dereferenced)
When the test:

  if (i == activeTraffic.end() || (activeTraffic.empty()))

was true, the iterator named 'current' was uninitialized and later
dereferenced.

Fix:
  - when the previously-mentioned test is true, return;
  - initialize 'current' only when it is really needed (i.e., later and
    after the test), and since we don't need it for iterating, make it
    an FGTrafficRecord&.
2017-05-10 16:54:55 +02:00
Henning Stahlke
43e19c1123 YASim: revert a change in Model.cpp that caused segfaults on some systems. 2017-05-10 16:27:46 +02:00
Alessandro Menti
c00f98b0d1
QT Launcher spelling/style fixes
Fix a couple of spelling mistakes, as well as some terms which are
styled differently in the main FG interface.
2017-05-08 21:29:42 +02:00
Henning Stahlke
222361bf66 YASim bufix segfault with helicopters. 2017-05-05 13:47:47 +02:00
Henning Stahlke
35f6811ce3 YASim: trivial code clarification in Wing.cpp 2017-05-04 15:33:13 +02:00
Henning Stahlke
caf2100b5e YASim: code dedup in class Wing. 2017-05-04 15:18:48 +02:00
Henning Stahlke
6817292e73 YASim: changed constructor for Wing. Creating a Wing object without basic geometry data is pointless and this data cannot change during runtime. 2017-05-04 14:31:43 +02:00
Henning Stahlke
614f05bb39 YASim: split Wing::compile into smaller functions (2). 2017-05-04 14:12:30 +02:00
Henning Stahlke
4584c83d8b YASim: split Wing::compile into smaller functions (1). 2017-05-04 14:02:11 +02:00
Henning Stahlke
eb6bb087f6 YASim: include yasim-common.hpp in Wing.cpp and remove constant.
Trivial cleanup and variable name clarification.
2017-05-04 13:52:21 +02:00
Florent Rougon
2ad164e80f Improve handling of the pushBackRoute attribute in groundnet's Parking nodes
- Don't ignore pushbackRoute="0".

- Stricter parsing with precise log messages when the input is
  incorrect.

- Add missing includes in src/Airports/dynamicloader.cxx.

See <https://sourceforge.net/p/flightgear/mailman/message/35788373/> for
the discussion about this change.
2017-05-04 10:30:51 +02:00
Florent Rougon
df2a98d245 Fix warnings about unreferenced local variables
Warnings seen on Jenkins with Visual Studio.
2017-05-04 09:41:29 +02:00
Henning Stahlke
b0a831e667 YASim: initialize floats with 'f' suffix to avoid problems with windows build 2017-05-03 22:17:08 +02:00
James Turner
2747a33e6b Merge /u/jsb1685/flightgear/ branch yasim into next
https://sourceforge.net/p/flightgear/flightgear/merge-requests/89/
2017-05-02 15:09:13 +00:00
James Turner
9e7924a4b1 Silence a warning. 2017-05-02 12:45:32 +01:00
James Turner
2dbe88936e Don't warn about missing CrashRpt when developing 2017-04-29 20:58:05 +01:00
Henning Stahlke
37c43ab6dc YASim: add initalizer to Wing.hpp, cleanup constructor. 2017-04-29 12:54:56 +02:00
Henning Stahlke
b4743b3830 YASim: add initalizer to Model.hpp, cleanup constructor. 2017-04-29 12:54:56 +02:00
Henning Stahlke
f9334d8c39 YASim Surface move initialization 2017-04-29 12:54:56 +02:00
Henning Stahlke
efde524685 YASIM move constants to a common header file. 2017-04-29 12:54:55 +02:00
Erik Hofman
072bad4f50 sync. with JSBSim and expose Oil_Press_Relief_Valve, Oil_Press_RPM_Max, Design_Oil_Temp, Oil_Viscosity_Index 2017-04-27 15:41:23 +02:00
Henning Stahlke
0a0402f667 YASim Airplane refactoring (code dedup). 2017-04-25 09:19:25 +02:00
Henning Stahlke
e604f2f662 YASim BodyEnvironment rename methods and split setupState into two methods. 2017-04-25 09:19:25 +02:00
Henning Stahlke
add6c6b8a8 YASim: Airplane solver uses standard atmosphere so we can replaced atmosphere members with floats for altitude and pass those to setup atmo where needed directly from altitude. 2017-04-25 09:19:25 +02:00
Henning Stahlke
8064135665 YASim: Moved Airplane::setupState to BodyEnvironment 2017-04-25 09:18:26 +02:00
Henning Stahlke
ed6dee3f55 YASim Airplane: add initalizers. 2017-04-24 18:31:03 +02:00
Henning Stahlke
8bd8d5f163 YASim Model move one-liner to header. 2017-04-24 00:08:36 +02:00
Henning Stahlke
3457c3c61f YASim: convert Atmosphere to a non-static class so we can pass around air parameters in one object instead of several variables. 2017-04-22 16:14:52 +02:00
Henning Stahlke
5e99f92a0f YASim: conver Airplane::setupState from static to const 2017-04-22 15:06:02 +02:00
Henning Stahlke
2229b0a494 YASim: mark methods of Version 'const' 2017-04-22 14:59:03 +02:00
Henning Stahlke
fcfc82b471 YASim: move one-liners and add 'const' 2017-04-21 22:17:27 +02:00
James Turner
cbdbe2882b Fix disabled appearance of toolbox buttons.
Ensures ‘fly’ button appears disabled as appropriate in the 
launcher.
2017-04-19 13:31:45 +01:00
James Turner
a05860608b Fix erroneous button highlighting. 2017-04-19 13:12:48 +01:00
Henning Stahlke
ef9fa25b94 YASim: update default for desired cg range. 2017-04-18 22:27:35 +02:00
Henning Stahlke
1302c167dd YASim: rename some exported props. 2017-04-18 22:11:34 +02:00
Henning Stahlke
73de375249 YASim declared get methods as const. (correction to previous commit) 2017-04-18 19:12:23 +02:00
James Turner
503907be34 Merge /u/jsb1685/flightgear/ branch yasim into next
https://sourceforge.net/p/flightgear/flightgear/merge-requests/87/
2017-04-18 09:05:57 +00:00
Henning Stahlke
3f0ef99c71 YASim: add MAC (mean aerodynamic chord) and c.g. calculations. 2017-04-17 22:52:26 +02:00
Henning Stahlke
574f2f907f YASim: add setAirFromStandardAtmosphere() to Class Model. 2017-04-17 20:10:46 +02:00
Henning Stahlke
7f5a91ea47 YASim: refactoring loadControls() 2017-04-17 20:09:44 +02:00
Henning Stahlke
dbfe9a7b41 YASim: clean up export of aero force and ground effect force to prop tree. 2017-04-17 19:54:26 +02:00
James Turner
b006ef5c78 Launcher: fix navaid map default scaling. 2017-04-15 14:18:02 +01:00
James Turner
f2d5f18da6 Title label for location airport/nav pages. 2017-04-15 14:18:02 +01:00
Florent Rougon
4259b548b0 Fix bugs due to incorrect use of SGPath::pathListSep
Before SimGear commit a962c90b30f36575d01162b64471fa77473237a0,
SGPath::pathListSep was a char in static memory that was not necessarily
followed by '\0'. As a consequence, using &SGPath::pathListSep as a
C-style string could result in a string containing the correct separator
*plus* whatever followed in memory until the first null byte...

SimGear commit a962c90b30 changes this situation by making
SGPath::pathListSep an array of two const chars: the path list separator
followed by a '\0'.

This commit simply adapts FlightGear to this change, which fixes a
couple of bugs where the separator was used, mainly unneeded NavCache
rebuilds due to the "apt.dat", "fix.dat" and "nav.dat" properties in the
SQLite database containing the correct paths separated by a possibly
incorrect separator string (there was no alteration of the cache
contents as far as I can tell, since the db property is only used to
check if the lists of apt.dat, fix.dat and nav.dat files have changed).
2017-04-15 09:53:16 +02:00
James Turner
5fa9242d7a Launcher: fix handling of prop custom args.
The parser wasn’t special case these, and they have to be handled
differently to work now.
2017-04-15 08:39:18 +01:00
James Turner
ec9989c244 FIx build issue with previous commit. 2017-04-14 22:16:22 +01:00
Richard Harrison
feca0a73ba Multiplay: Fix transponder property definitions 2017-04-14 19:46:12 +02:00
James Turner
95a6d31e18 Launcher: update all aircraft UI.
Replaces more complex previous attempt, which was also not hooked
up properly, ooops.
2017-04-14 18:31:23 +01:00
James Turner
c19fc6bc06 Launcher: add ‘show console’ setting on Windows
This entailed fixing the handling of the visibility property with an
override from the QWidget basic version.
2017-04-14 17:36:28 +01:00
Florent Rougon
eefa9a75f9 Fix crash in AI code when buggy groundnet declares pushback hold point on runway
Some buggy *.groundnet.xml files (as KSEA currently on TS) define the
pushback hold point for some parking positions as a node on a runway.
In this case, this the pushback hold point for parking
'North_Cargo_Ramp', defined as node 5344 in
Airports/K/S/E/KSEA.groundnet.xml, which is defined twice (second error),
first as:

<node index="5344" lat="N47 27.774559" lon="W122 18.465257" isOnRunway="1" holdPointType="PushBack"  />

and then as:

<node index="5344" lat="N47 27.725747" lon="W122 18.159649" isOnRunway="1" holdPointType="PushBack"  />

(due to code in flightgear/src/Airports/dynamicloader.cxx, it should be
the second one that wins, which is not on a runway but on apron in the
north cargo area)

As a consequence, when this gate is selected for an AI aircraft, the
pushback route has only one node (since the pushback hold point is then
the closest point to itself supposedly on runway!), and the
corresponding FGTaxiRoute instance has an empty 'routes' member
variable, which FGTaxiRoute::next() doesn't handle gracefully
(segfault).

It may be that an additional check/change could be desirable in
FGTaxiRoute::next() in such a case (one node and obviously no route in
the FGTaxiRoute instance), however I'm not sure how Durk wants this case
to be handled, since FGTaxiRoute::next() seems to iterate on nodes.

This fixes the bug reported at:

  https://forum.flightgear.org/viewtopic.php?p=308397#p308397 and
  https://sourceforge.net/p/flightgear/mailman/message/35776552/

Thanks to yanfiz and wkitty42 for the report, and to gooneybird for
inspecting the groundnet file.
2017-04-14 12:25:00 +02:00
Florent Rougon
caf3a4253d Use FGTaxiNode::getIndex() instead of FGTaxiNode::ident() in a dev warning
This is because FGTaxiNode::ident() is generally (always?) an empty
string for FGTaxiNode instances. This concerns the:

  unreferenced groundnet node: ...

warning. Also remove one tiny use of boost.
2017-04-14 12:21:54 +02:00
Florent Rougon
2373ee4f05 Fix build error due to sgstream.hxx now being in simgear/io/iostreams/ 2017-04-14 00:19:59 +02:00
James Turner
cf56ef1913 Migration test runs successfully now. 2017-04-13 13:14:53 +01:00
James Turner
ac38f29ae3 Launcher: exit/quit item on non-Mac
(Mac gets one automatically)
2017-04-13 13:01:29 +01:00
James Turner
5f8f2886dc Launcher: fix bugs around paths setting.
We now show paths in ‘view command line’ and set them through the
standard mechanism. Re-ordering the paths also notifies the rest of
the system correctly.
2017-04-13 12:55:51 +01:00
James Turner
dd0b9adbfc Comsetic launcher tweaks. 2017-04-13 09:19:19 +01:00
James Turner
3e1a701712 Migrate old autosave XML files. (Disabled for now)
Code and tests to demonstrate migrating of older auto-save files, with
blacklisting support to exclude properties. Disabled pending agreement
on the required blacklisting values.
2017-04-13 08:01:45 +01:00
Richard Harrison
a9a85a618e Remove duplicated properties from multiplayer defintions.
This may have impacted the ability of the binary search to function correct.
2017-04-13 06:08:36 +02:00
James Turner
9f47607c95 Revert "Remove the Ati viewport hack."
This reverts commit 5bf9b3cd02.
2017-04-12 11:13:14 +01:00