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.
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.
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.
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.
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.
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.
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.
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.
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').
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.
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.
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 |
+---------------+-------------+------------+
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.
- 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.
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
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>
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.
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.
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>
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.
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).
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.
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.
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>
- 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").
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/
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.