1
0
Fork 0
Commit graph

12222 commits

Author SHA1 Message Date
Erik Hofman
098300bb51 Use mmapping when reading Nasal scripts saving two memory copies out of for (copy from disk to the i/o buffer, copy from the i/o buffer tot the ifstream, copy from the ifstreamto a string and copy from a string to Nasal). 2023-02-25 10:03:03 +01:00
portree_kid
a2b10c1ee3 AI Flightplan Leg 4 departure curve 2023-02-08 19:37:33 +01:00
Stuart Buchanan
ac8c5386a9 Default loading threads to 4 with 0 HTTP-dedicated 2023-01-30 23:03:58 +00:00
Stuart Buchanan
af8f71db40 WS30 - Autogenerate 70% of earth surface
Generate Ocean tiles where no scenery is available.

As a side-effect, this also fixes bug which caused
sim to hang if unable to find WS3.0 scenery at
starting location.
2023-01-29 21:50:04 +00:00
portree_kid
78797e28aa AI Fixes
* Better runway exit
* Bug in approach
* Test east/west approach downwind
2023-01-28 20:48:11 +01:00
Erik Hofman
20fc979a52 Move more code to C++, use SGPath and SGMMapFile to map the Nasal file instead of copying it. 2023-01-24 09:50:54 +01:00
Florent Rougon
7ddb78a648 Nasal standalone interpreter: make SGPath::validate() accept everything
Allow the standalone Nasal interpreter to read and write files or
directories everywhere, as long as permitted by the operating system.
2023-01-23 18:20:51 +01:00
Erik Hofman
484f1da20e Fix the build for systems without a system wide sqlite lubrary 2023-01-23 15:35:24 +01:00
Erik Hofman
f492f9bf6e sqlite_open_v2 requires sqlite3_close_v2 (I think, not really clear). 2023-01-23 14:50:51 +01:00
Erik Hofman
446cf2eb05 Run the SQLite path through the path validation mechanism 2023-01-23 11:52:17 +01:00
Erik Hofman
e3fd08dd82 Add SQLite support to Nasal and copy the nasal-bin utility over from SimGear, make it C++11 and add it as an installable nasal interpreter for standalone testing and debugging of local nasal scripts. 2023-01-23 09:53:07 +01:00
James Turner
98958af2a3 GUI: add explicit close hook to FGDialog
Allow triggering close of dialogs explicitly, rather than relying on
ref-count drop to delete them. Compat dialogs have a Nasal peer and
we can't rely on GC to cause a timely close of the dialog.
2023-01-20 16:08:54 +00:00
James Turner
029ce8f0df WS3: add tags+breadcrumbs for Sentry
Record some key values to help understand differing WS3 performance
results by some testers, and add a tag when WS3 is enabled.
2023-01-16 11:07:56 +00:00
Erik Hofman
c872b8b4b2 CycloneDDS aparrently stopped supporting booleans 2023-01-15 14:32:42 +01:00
James Turner
2be54f9eae PUICompat: fix default value in configValue() 2023-01-11 11:45:01 +00:00
James Turner
de40779109 Canvas: Expose raw image dimensions to Nasal 2023-01-10 14:18:19 +00:00
James Turner
f463a0405e Fix some dumb paths in the code
Replace hard-coded path to my desktop with calls to
SGPath::desktop() helper
2023-01-10 10:34:14 +00:00
James Turner
36df4c38de More snprintf conversions 2023-01-09 15:04:07 +00:00
James Turner
01b93cb8a0 Sprintf: make buffer size explicit in replay 2023-01-09 12:55:31 +00:00
James Turner
0f71686388 Another sprintf fix in PVE protocol this time 2023-01-09 10:57:21 +00:00
James Turner
f7b0b77abb PU.h sprintf fixing
Adjust our customised pu.h to use snprintf, with correct buffer
size information. Also adjust includes so our custom version is used, ]
even when including the system puAux.h.
2023-01-09 10:55:58 +00:00
James Turner
4c42600898 Sprintf to snprintf fixes
Reduce warning from Clang about use of sprintf.
2023-01-08 19:36:44 +00:00
James Turner
3b36379c5c Nasal: improve module delete/reload
Allow modules to define an unload callback, and also drive
the 'loaded' property to false, to give modules the ability to clean
up when being unloaded. This makes reloading work without
errors for Canvas.

Additionaally, add some special code when creating the
Canvas module, to ensure the C++ defined pieces are loaded :
fortunately Canvas is the only module which needs this.
2023-01-06 10:41:01 +00:00
James Turner
3f742c1b1d Expose new Canvas methods to Nasal
Requires corresponding SimGear update
2023-01-05 14:06:46 +00:00
James Turner
fc842c17f0 Canvas: LayoutItem.setVisible can be chained
Wrap LayoutItem::setVisible so it returns self, and hence can be chained,
similar to methods implemented in Nasal.
2023-01-04 15:22:24 +00:00
James Turner
1b07851374 Canvas Layout: check arguments to add/insertItem
When the ItemRef argument is null, report a runtime error
instead of crashing.
2023-01-04 14:16:24 +00:00
D-ECHO
1889045891 YASim Hitch: correct typo brake to break 2023-01-04 10:58:37 +00:00
Roman Ludwicki
56aa2cd479 Prevent from closing the simulator just because it can't write to the logger file 2023-01-03 11:13:48 +00:00
portree_kid
3667e5de3c AI/ATC
* Added Messages for Takeoff
* Added Messages for Hold & Holdpatterns
* More enums instead of Magic Numbers
2022-12-29 22:21:23 +01:00
Gianfranco Costamagna
11eca7825d Fix build on riscv64 by using atomic int instead of atomic bool.
gcc on riscv64 is not able to compile natively atomic int, because of hw constraints, leading
to an additional to link external atomic libraries, making the code really slower to run.

Instead, using std::atomic<int> can be compiled and optimized natively without any additional -latomic linking.
2022-12-11 08:48:15 +01:00
portree_kid
097603452e Merge branch 'next' of ssh://git.code.sf.net/p/flightgear/flightgear into next 2022-12-03 21:48:42 +01:00
James Turner
e08eee587d Route-manager: is expose is-route property for UI 2022-12-02 12:22:15 +00:00
James Turner
78e6a209f1 Add some missing cases to Nasal FlightPlan binding
Expose 'between' restrictions as a 2-tuple.
2022-12-02 12:22:15 +00:00
Stuart Buchanan
56996cc01a WS30 - Clear WS30 data on tile unload
Previously WS30 data from STG files - in particular road/rail/river
data - was kept permanently.

This change unloads it with the STG-level tile.  This is the right
level to do so, as it will be reloaded from tile when the STG file
is loaded again.
2022-12-01 16:43:23 +00:00
Stuart Buchanan
ebe511439a Control number of database pager threads from prop
Previously we were hardcoded to 2 database pager threads,
one for files and one for http.

This commit adds a new property /sim/rendering/database-pager/threads
to control the number of threads on startup.

It also re-orders the code to set the database pager so that such
a setting has an effect.
2022-12-01 16:39:50 +00:00
Erik Hofman
bc3e80b2cb Sascha Reißner
Change all constant numeric values with the defined constant.
Changed the wrong '*offset-m' properties and the 'rollspeed-ms' property.

Maybe the wrong offset properties hasnt popped up because no dev used
it. This value will not be used in any animation because its normally a
fixed value that doesnt change at runtime.
2022-12-01 08:40:24 +01:00
Erik Hofman
2c0b3d20a2 Sascha Reißner
With this patch, the dev can set <max-compression-ft> or <max-compression-m> in the set-file (or another
xml-file that get included from the set-file).
The code calculates also 'compression-m' for every gear.
If the 'max-compression-*' property is omitted, the code behave as before ('compression-norm' is the same as 'compression-ft').
2022-11-30 08:43:10 +01:00
Edward d'Auvergne
c8e7a019f5 Revert "SGSubsystemMgr: Switch to the new add() function with a single subsystem object argument."
This reverts commit 30d63b7209.
2022-11-29 22:23:34 +01:00
Edward d'Auvergne
30d63b7209 SGSubsystemMgr: Switch to the new add() function with a single subsystem object argument.
This allows for the static class ID, GroupType, and update interval to be automatically extracted
from the subsystem registration information.
2022-11-29 16:36:05 +01:00
Edward d'Auvergne
12ca368868 SGSubsystemMrg GroupType fixes for a few subsystem registrations. 2022-11-29 11:41:34 +01:00
Edward d'Auvergne
790b553500 Fix for incorrect subsystem grouping introduced in c5aa3ca0f1.
Some of the subsystems created in the fg_init fgCreateSubsystems() function were accidentally
shifted into the subsystem group SGSubsystemMgr::GENERAL, as these subsystems cannot be currently
registered with the subsystem manager and still have to use the non-templated subsystem manager
add() function.
2022-11-28 21:49:24 +01:00
James Turner
0a85e23cde Extend FlightPlan to handle ‘between’ restrictons
As part of this, also improve units handling in speed/altitude
restrictions.
2022-11-28 15:34:00 +00:00
James Turner
73463a3a98 Atmosphere: add ISA Mach conversion helpers
This is being added for use in FlightPlans, but replace equivalent
code in AIBallistic which showed up. As part of this, simplify 
AIbase.
2022-11-28 15:33:15 +00:00
portree_kid
b1186e7da2 Merge branch 'next' of ssh://git.code.sf.net/p/flightgear/flightgear into next 2022-11-27 17:17:21 +01:00
portree_kid
f0b7e9c048 AI logging for missing runway at arrival airport 2022-11-27 17:16:17 +01:00
Stuart Buchanan
4f01ddb1cc WS30 - Remove log spam for missing tiles
Previously any missing WS30 tiles created multiple OSG WARN
messages from the file not being found.  This change does a check
to ensure the file actually exists before put it on the queue for
loading.
2022-11-27 14:31:46 +00:00
Stuart Buchanan
e6c2e258b5 Fix crash on exit
NasalModelDataProxy destructor relies on globals being valid.
2022-11-27 14:29:11 +00:00
portree_kid
ccf674e189 AI Prevent Segfault when aircraft gets bogus flightplan 2022-11-23 14:37:30 +01:00
Richard Harrison
bd4e7462ac Permit AI model to define basic submodel collision parameters.
AI models have rudimentary collision detection with submodels that performs two tests.

1. The height difference must be less than a defined amount
2. The centre point range must be less than a defined amount.

(2) above by itself would result in a spherical comparison; however (1) effectively modifies this to slice off the top and bottom of the sphere so that the sphere heigh is half of the value in (1).

Previously these heights and lengths were hardcoded - this change allows these to be defined in the xml instead using the <collision-length> and <collision-height> tags

e.g.
    <entry>
      <type>ship</type>
      <collision-length type="double">50</collision-length>
      <collision-height type="double">50</collision-height>
    </entry>

Default values:
+---------------+-------------+------------+
| Type          | Height(m)   |  Length(m) |
+---------------+-------------+------------+
| Null          |      0      |        0   |
| Aircraft      |     50      |      100   |
| Ship          |    100      |      200   |
| Carrier       |    250      |      750   |
| Ballistic     |      0      |        0   |
| Rocket        |    100      |       50   |
| Storm         |      0      |        0   |
| Thermal       |      0      |        0   |
| Static        |     50      |      200   |
| Wingman       |     50      |      100   |
| GroundVehicle |     20      |       40   |
| Escort        |    100      |      200   |
| Multiplayer   |     50      |      100   |
+---------------+-------------+------------+
2022-11-21 22:00:26 +00:00
portree_kid
95a274c135 Merge branch 'next' of ssh://git.code.sf.net/p/flightgear/flightgear into next 2022-11-20 21:55:32 +01:00
portree_kid
b8d173c3e4 #2358 AI Aircraft not taking off 2022-11-20 21:55:25 +01:00
Edward d'Auvergne
c1c7b043ac SGSubsystemMgr::get_subsystem(): Universal switch to the templated function.
The globals non-templated get_subsystem() helper function has been made private
to enforce the switch.
2022-11-17 15:57:39 +00:00
Edward d'Auvergne
c5aa3ca0f1 SGSubsystem classes: Switch to the new SGSubsystemMgr::add() functions.
Most subsystems are now created via the subsystem manager using the global
subsystem registrations.

The FGGlobals add_subsystem() and add_new_subsystem() methods have been removed
as the subsystem manager addition and creation function interface now exceeds
the functionality of these helper functions.
2022-11-17 15:57:39 +00:00
Edward d'Auvergne
ad33e50324 SGSubsystem classes: Registration of all subsystems added since mid 2018. 2022-11-17 15:57:39 +00:00
Roman Ludwicki
ec52a4ee7b Add possibility to call ls2 telnet command without dir parameter (like for ls command) 2022-11-13 18:38:42 +01:00
Stuart Buchanan
535c5a5ff1 Scenery data attribution - sources.xml
Read a sources.xml file in Scenery directories and copy into
the property tree under /scenery/sources

Expected format:

<?xml version="1.0"?>
<PropertyList>
    <source>
        <name>Corine Land Cover (CLC) 2018, Version 2020_20u1</name>
        <link>http://web.archive.org/web/20221112175615/https://land.copernicus.eu/pan-european/corine-land-cover/clc2018?tab=metadata%2A</link>
        <license>GMES Open License</license>
    </source>
    <source>
        <name>NASADEM Merged DEM Global 1 arc second V001</name>
        <link>https://www.earthdata.nasa.gov/</link>
        <license>Public Domain</license>
    </source>
    <source>
        <name>OpenStreetMap</name>
        <link>https://www.openstreetmap.org/copyright</link>
        <license>Open Data Commons Open Database License</license>
    </source>
</PropertyList>
2022-11-12 20:45:01 +00:00
portree_kid
9b4bd6fdcb AI Better approach descent 2022-11-12 21:18:16 +01:00
James Turner
d8f212ed3b Adjust Nasal reload command name
Avoid conflict with modules.nas command that does something
similar. Command is now 'nasal-reload'.
2022-11-10 11:20:58 +00:00
James Turner
c509744b0f Nasal: support for module reload via command
This won’t work for all modules, depending on what inter-dependencies
exist.
2022-11-08 22:38:04 +00:00
James Turner
6bb22caea2 PUI Compat: handle failed loads without crash 2022-11-08 22:38:04 +00:00
James Turner
c6ed57d04b Fix an occasional traffic crash 2022-11-08 22:38:04 +00:00
Stuart Buchanan
6d76b657d6 WS30 - remove separate water mesh option
No longer required now water shader integrated into
main ws30 shader.  Also clean up.
2022-11-08 21:47:41 +00:00
Florent Rougon
0deaec870a Adapt to SG 952d071c0 (SGSoundSample ctor now takes std::unique_ptr by value)
The aforementioned SG change[1] was done in line with Herb Sutter's
writing at [2] in order to clearly express sink semantics.

[1] 952d071c08/
[2] https://herbsutter.com/2013/06/05/gotw-91-solution-smart-pointer-parameters/
2022-11-08 14:34:24 +01:00
Florent Rougon
876330772b Navradio: fix regression and optimize older code
- Fix a little regression introduced in commit d2f4807fa2: changing
  the standby frequency disabled the low-pass filter for the next call
  to updateReceiver(); this must happen when the selected frequency is
  changed but not when the standby frequency is changed. This is covered
  by the recently-added unit test NavRadioTests::testVORSignalQuality.

- Optimization of the older code: no need to perform a navaid search()
  when only the standby frequency is changed.
2022-11-08 12:01:24 +01:00
Florent Rougon
d2f4807fa2 Navradio: disable low-pass filter when changing selected freq or leaving GPS slave mode
When the selected frequency is changed or when leaving GPS slave mode,
disable the low-pass filter applied to signal quality. Otherwise, the
following may happen for instance:
  - the active frequency corresponds to a navaid whose signal is well
    received;
  - user makes it so that the Morse code for the navaid ID can be heard;
  - user then changes the selected frequency to one that doesn't belong
    to a navaid that is close enough to be usable;
  - yet, as soon as the frequency is changed, the Morse code for the ID
    of the newly selected navaid (if any), even if it is way too far for
    its signal to be received, will be very clearly heard for about one
    second---and likely truncated.

This is because before this commit, after the frequency change, the
low-pass filter applied to signal quality made the code behave as if the
signal, supposedly coming from the new navaid, were still strong---which
of course doesn't correspond to physical reality. This fixes the bug
reported at [1].

[1] https://forum.flightgear.org/viewtopic.php?f=25&t=40890#p405708
2022-11-05 19:01:04 +01:00
Florent Rougon
1b5116fb32 Navradio: remove outdated comment 2022-11-05 19:01:04 +01:00
James Hogan
5645d0b558
Splash: Drop debug logging noise
Drop some unintentional debug logging noise from the sRGB support
detection code.
2022-11-05 17:31:53 +00:00
James Hogan
ab02bce279
CameraGroup: Fix missing splash on explicit camera setup
The splash window name was only being set for the default / legacy
camera setup, however if the camera group is set up explicitly in the
configuration XML the splash window wouldn't get set and the splash
would no longer get displayed.

This is fixed by selecting the first referenced window name from a
camera.

A better fix (more closely matching the prior behaviour) would be to
create a splash camera for each created window, however this is proving
difficult to test due to instability with multiple windows, so this fix
will suffice in the mean time.

Fixes: bb0d7fc0a7 ("src/Viewer: Move splash to cam group camera")
Reported-by: Durk Talsma <durktals@gmail.com>
2022-11-05 17:19:22 +00:00
Roman Ludwicki
fd0bb74a92 Replace displaying in Launcher --on-ground=false to --in-air for on final
The option`--on-ground=false` doesn't exist which can be misleading.
2022-10-26 21:52:40 +02:00
Stuart Buchanan
64ae52438b Fix uninitialized variable valgrind warning 2022-10-11 22:08:29 +01:00
James Turner
86f82994be Fix crash on METAR without cloud coverage set
As suggested by Scott, when a layer has no coverage set,
use the coverage of preceeding layer (lower down, closer to
the ground)

SF-ID: https://sourceforge.net/p/flightgear/codetickets/2765/
2022-10-06 09:05:37 +01:00
James Turner
a7d13e0736 Fix missing untie in NewGui::shutdown 2022-09-30 09:36:20 +01:00
Florent Rougon
09ea80d12d FGSoundManager::playAudioSampleCommand(): update comment
The 'instant' queue doesn't work like other queues.
2022-09-26 16:00:19 +02:00
Erik Hofman
280fdecad0 Use a random string for a reference name so samples from the instant queue wich are using the same sound file will play simultaneously. 2022-09-25 10:16:12 +02:00
Erik Hofman
ee3ea86891 Tie the instant queue to the listener 2022-09-24 10:24:49 +02:00
James Turner
190d393cd2 Refactor graphics init to pass in the context 2022-09-22 11:39:15 +03:00
James Turner
e87e42e5fa Add an exception for a reported crash in Metar 2022-09-18 10:59:29 +02:00
James Turner
93cb7e1e93 Error reports: set context before loading FGFX
Set the relevant context property before loading FGFX, so fx-load 
errors are correctly attributed to the aircraft.
2022-09-12 13:31:57 +01:00
Erik Hofman
5acf2e26d0 Add a special queue-name 'instant' which does not put samples into a sample queue but plays them instantly. 2022-09-12 09:52:31 +02:00
Colin Geniet
5d6ac7a1c1 MP: Fix recurrent bool array compatibility issues
When FG encounters an unknown property id in a MP packet, it discards
the remainder of the packet. This happens when adding new MP properties:
older clients will discard the property and anything that comes after.
This is normally not an issue because newer properties are placed at the
end of the packet.

However MP bool array properties (sim/generic/bool[*]) are transmitted
at the very end of a packet, meaning they get broken (for backward
compatibility) each time a property is added to the protocol.

Fix this by placing them earlier in the packet, with the same ordering
rules as other properties.
2022-09-09 08:02:08 +01:00
Colin Geniet
e6327466e6 MP: Reorder new property for backward compatibility
Commit 6aff646cf (Mach number added to mode-S XPDR properties, 2022-07-20)
added /instrumentation/transponder/mach-number as a new MP property.

It was inserted with other transponder properties, in the middle of
the list of MP properties. This breaks backward compatibility:
older FG client discard any property after this.

Move the new property to the end of the list, with the largest id.
2022-09-09 08:02:08 +01:00
James Turner
97c7b6402e PUICompat: fix Nasal module for bindings 2022-09-09 08:01:13 +01:00
James Turner
745aef04ea Splash : restore macOS compatibility
Change to sRGB frame-buffer unfortunately broke macOS compatibility;
restore it by reverting to the internal format there.
2022-09-05 16:56:50 +01:00
James Turner
8b036f9353 GeneralInitOperation: guard against duplicate calls 2022-09-05 12:53:40 +01:00
James Turner
e5aee5adf6 open-browser: always prefix paths with file://
Make opening a local file explicit as a URI, on all platforms (before,
this was only done on macOS)
2022-09-05 12:53:21 +01:00
James Hogan
91ddbf6a7c
VRManager: Fix crash on exit on Windows
VRManager::instance() was using a function scoped static osg::ref_ptr to
store the VRManager instance. However it needs to be used from
fgOSCloseWindow(), which is called from an atexit handler, and C++11
specifies that static object destruction and atexit handlers are reverse
sequenced, i.e. a static object initialised after an atexit call will be
destroyed before the atexit callback is called.

On Windows this can result in the osg::ref_ptr being destroyed (and
hence set to NULL) before fgOSCloseWindow() tries to call
destroyAndWait() on the instance.

Fix the resulting seg fault by moving the ref_ptr object to static file
scope so it is default constructed before the atexit call, and using
only a simple static bool to initialise it on first call to
VRManager::instance().

Reported-by: Alan Teeder <ajteeder@v-twin.org.uk>
2022-08-29 22:06:49 +01:00
portree_kid
e85e5d2e5b AI
* Parking on parking with right heading
* Leg 6 Descent improved (teardrop like entry)
* Inner/Outer tangents in VectorMath TODO Move to SG
2022-08-29 21:05:49 +02:00
Florent Rougon
3ee54cbd72 Revert "Call fgInitAllowedPaths() also in fgInitConfig()"
This reverts commit e7594f4687.
2022-08-28 11:49:37 +02:00
Florent Rougon
896be707ae Revert "Call fgInitAllowedPaths() between updates of aircraft paths and -set.xml parsing"
This reverts commit 9fc5f30a93.
2022-08-28 11:49:30 +02:00
Florent Rougon
9fc5f30a93 Call fgInitAllowedPaths() between updates of aircraft paths and -set.xml parsing
fgInitAircraft() loads the aircraft -set.xml file, which calls
ResourceManager::findPath() for each 'include=...' directive. In order
to prevent such includes from triggering the new warning printed by
ResourceManager::findPath(), call fgInitAllowedPaths() after the
aircraft paths have been updated and before the -set.xml file is loaded.
Thanks to Alan Teeder for reporting the problem.

We can now probably remove the call to fgInitAllowedPaths() after
processOptions() in fgStartNewReset() (I believe the newly-added call
comes “soon enough”). Not doing so in this commit, though: let's fix
problems before optimizing.
2022-08-27 20:01:55 +02:00
Florent Rougon
563bc4775f Minor changes
Fix a typo and a warning about an unused variable.
2022-08-24 15:14:57 +02:00
Florent Rougon
e7594f4687 Call fgInitAllowedPaths() also in fgInitConfig()
This is an additional call to fgInitAllowedPaths(), earlier than the
normal one. It doesn't know the paths given to --allow-nasal-read, but
can already authorize read access for all of $FG_ROOT. This allows one
to add SGPath::validate() checks for paths given to
ResourceManager::findPath() with a non-null second argument (without
this change, the validation would fail for files included from
defaults.xml, read by fgSetDefaults() before the definitive
fgInitAllowedPaths() call has been performed).
2022-08-24 01:31:39 +02:00
Florent Rougon
36dd57f6f4 Don't look for the splash screen font in the aircraft dir
The previous way only worked because after trying
SGPath(aContext, aResource), ResourceManager::findPath() tries all
providers, among which there is a BasePathProvider with $FG_ROOT as its
base... provider which doesn't use the 'aContext' argument at all.
2022-08-24 01:31:04 +02:00
Florent Rougon
ee12883eb6 Replace fgValidatePath() with SGPath::validate()
Move the fgValidatePath() code and the two associated static variables
'read_allowed_paths' and 'write_allowed_paths' to SimGear.
fgValidatePath() is now known as SGPath::validate(). This requires
SimGear commit e002a481f481709263a.
2022-08-22 13:35:15 +02:00
James Hogan
199adf90df
VRManager: Update to osgXR 0.5.0
osgXR 0.5.0 broke the API slightly, so update VRManager to use the new
enumeration names and update the required osgXR version for when using a
system version of osgXR.

Signed-off-by: James Hogan <james@albanarts.com>
2022-08-21 17:55:18 +01:00
Florent Rougon
60ff405efc FGSoundManager: fix path handling in playAudioSampleCommand()
- Use the complete path when performing the existence check (previously,
  only the directory part was used: bug in commit
  8853fded29).

- Use the resolved path (SGPath instance) obtained from
  FGGlobals::resolve_maybe_aircraft_path() when constructing the
  SGSoundSample instance; this makes it possible to use paths starting
  with the '[addon=...]' special prefix (handled by the
  AddonResourceProvider) with FGSoundManager::playAudioSampleCommand(),
  and therefore with the 'play-audio-sample' FGCommand.

This requires SimGear commit 8febf6b9f58e9a1919ff3 ("SGSoundSample
constructor changes").
2022-08-20 08:27:45 +02:00
Florent Rougon
a502de9e81 FGPUIMenuBar: small optimization (requires C++17) 2022-08-18 17:39:08 +02:00
Florent Rougon
afe7d996af FGPUIMenuBar: fix bug when several menu entries have the same label
Before this commit, if several menu entries (possibly in different
menus) had the same label after translation and latin1-ization by
FGLocale::utf8toLatin1(), selecting one of them used to fire the
bindings associated to all such entries. This is because the bindings
used to be stored in an std::map whose keys were the
translated-and-latin1-ized labels.

This commit fixes the problem in the following way:
  - the std::map (_bindings) is turned into an std::forward_list;
  - each element of this std::forward_list references the bindings
    assigned to a menu entry;
  - in order to allow FGPUIMenuBar::fireItem() to find the bindings
    assigned to the menu entry that triggered it,
    FGPUIMenuBar::make_menu() calls puMenuBar::add_submenu() with an
    additional argument ("user data") that attaches to the puObject for
    each menu entry a pointer to the relevant element of _bindings.

Note: given how the menubar is created, an std::vector wouldn't be
appropriate for _bindings, because we need the pointers to its elements
to be stable when new elements are added to _bindings.

Reported by Wayne Bragg: https://sourceforge.net/p/flightgear/mailman/message/37682605/
2022-07-27 00:30:12 +02:00
Michael Filhol
6aff646cfa Mach number added to mode-S XPDR properties, exposed to MP (for ATC). 2022-07-26 10:30:14 +01:00
James Hogan
dc5404a3c2
FGButton: Make init()'s "module" parameter const
FGButton::init() passes the module parameter (a non-const string
reference) straight through to FGCommonInput::read_bindings() as a const
reference.

Change the FGButton::init() signature so that module is const there too,
so that callers can pass it const string references returned by
accessors without having to make copies.
2022-07-13 23:46:23 +01:00