1
0
Fork 0
Commit graph

13428 commits

Author SHA1 Message Date
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