Essentially, adapt two places where options.xml was supposed to be found
in $FG_ROOT (in one of these, the comment was already incorrect way
before the recent change moving options.xml out of FGData).
$FG_INSTALL_PREFIX represents the FlightGear installation prefix, such
as /usr, /usr/local or /opt/FlightGear on Unix systems. Copying the
--help output and translated strings there avoids having to write to
$FG_ROOT when 'make install' (or some OS-dependent equivalent) is run
from the FlightGear build directory---that would be ugly when $FG_ROOT
points to the FGData Git repository.
In FGLocale::FGLocale(), Translations/locale.xml is loaded using
readProperties() and fatalMessageBox() (in case an error is
encountered). Note that it couldn't be loaded via fgLoadProps() in the
current state, because this function relies on guiErrorMessage() when an
error is encountered, which calls mkDialog(), which itself does
globals->get_subsystem("gui"). This last call can't be done from
FGGlobals' constructor---where the 'globals' pointer is still
NULL---hence the need for a different mechanism not relying on
FGGlobals.
For consistency, and also because it provides a better user experience[1],
load options.xml using the same method instead of with fgLoadProps().
[1] I.e., in case of an error, the user gets to see a graphical popup
window with an explanatory message before FG exits, assuming he is
either on Windows, or on Mac, or has Qt support built in FG, as
opposed to only an SG_LOG() call [because when options.xml is
loaded, guiErrorMessage() used by fgLoadProps() can't use the 'gui'
subsystem].
- Add an optional argument to flightgear::initApp(): doInitQSettings.
This argument defaults to true, preserving initApp()'s behavior in
this respect. If this argument is set to false, FGGlobals doesn't have
to be initialized.
- New function flightgear::initQSettings(), called by
flightgear::initApp() when its 'doInitQSettings' argument is true.
This allows initializing the QSettings exactly when it is needed.
- New function flightgear::checkKeyboardModifiersForSettingFGRoot().
The code it contains used to be run from initApp(), which is
undesirable because:
1) initApp() is not only called at FG initialization (fgMainInit()),
but also from QtMessageBox(), from QtFileDialog::exec() and twice
from Options::setupRoot(). However, checking the Alt and Shift
modifiers to set 'fg-root' in QSettings to the special value
"!ask" only makes sense in fgMainInit(), not in these other
places.
2) This code relies on the QSettings to be set up, and therefore on
FGGlobals. Thus, freeing initApp() of its dependency on FGGlobals
requires splitting this keyboard modifiers checking code out of
initApp().
This is likely to fix the problem preventing startup on Windows when the
username contains non-ASCII characters (cf.
<https://forum.flightgear.org/viewtopic.php?f=22&t=31320>). Thanks to
Headhunter76 for the useful report and to wkitty42 for doing the liaison
officer. ;-)
I can't actually test this, because I don't have Windows. Windows users
should report whether this works for them.
There is a Flightgear property called /sim/hitches/winch/automatic-release-angle-deg that can be used to simulate a safety feature built into modern gliders. If the cable angle gets too great during a winch launch, the hook will automatically release the cable. This usually happens when the glider gets almost on top of the winch at the top of the launch without releasing the cable.
Unfortunately winch launching has two separate implementations, one in Nasal for JSBSim, and another one in C++ for YASIM. The YASIM one does not implement this property so I wrote a patch to add this.
Previously timer objects defaulted to using wall-clock (real) dt which
does not reflect pause/speed-up. Keep this as the default for
compatibility but make it possible to request simulated time.
Special case handling when recently removed properties are re-added;
when this happens simply send a value change since it's much cheaper
over the wire and for the receiver. Poorly designed Canvas code does
this frequently (eg, every update)
- Handle file I/O and parsing errors. This allows current
<http://gateway.x-plane.com/navaids/LatestNavFix.zip> to be loaded
instead of failing in an endless loop.
Read the fields of a record with std::getline() followed by
simgear::strutils::split(), itself followed by calls to std::stoi(),
std::stof() and std::stod(). Stream extraction (>>) isn't very good
here, because it can read for instance an int *and* a float from the
string "3.14", i.e. extract 3 followed by 0.14 (thus falsifying the
number of fields found...).
Check the number of fields (not 100 % reliable since the last field,
the navaid name, typically contains spaces---but we can detect
some situations where the number of fields is definitely too low).
- Fix line numbering (sgstream.cxx's skipcomment() isn't fit for this
purpose, because it can gobble any number of lines without the line
number being increased).
- Don't use a hardcoded number of lines for the nav.dat loading
percentage indicator; rely on sg_gzifstream::approxOffset() instead.
- Make navDBInit() and loadCarrierNav() throw an sg_io_exception upon
I/O errors (not for parsing errors that only affect a record). They
don't return a bool anymore (which wasn't checked by their only
caller, anyway).
- Use the 'rowCode' variable name instead of 'rawType' for consistency
with the *.dat specs.
- Small change in tests: (elev_ft < 0.01) replaced with (elev_ft <= 0).
Doesn't change the behavior, since 'elev_ft' is an int. Can be
reverted if someone really prefers the float comparison, I don't mind
that much about it.
- Add missing headers and a few comments.
This commit does not change the contents added to the NavCache with
FlightGear's current $FG_ROOT/Navaids/nav.dat.gz, except for 4 bogus
navaids which are not added anymore (at LIBV, OPJA, RCFN and RCYU): see
<https://sourceforge.net/p/flightgear/mailman/message/35526617/>. They
are instead properly reported as coming from invalid nav.dat lines.
Since the Save function can be triggered from Nasal with an arbitrary
path, we must check this path before overwriting the file.
(also add a missing include that is directly needed for this commit)
Use a recursive listener to expose a property tree via a WebSocket.
Currently using a JSON-based encoding, will likely change to binary so
please don’t write code using this interface until the encoding
is stable and documented!
As discussed on the mailing list, make this more consistent with JSBsim.
We could still define common locations for these values as well, but
waiting on positive answer to that discussion on the ML.
Instead of the two vectors we manually composed, used a single unified
vector of structs to store delegate information in the model. This
simplifies the logic for tracking the active variant (and in the future,
thumbnail).
Search for the closest ground-net node near but /not/ on, the requested
runway. This works fairly well, although for some airports the selected
node is surprisingly far from the runway.
The report now looks like:
{
"meta": {
"type": "FlightGear JSON report",
"format major version": 1,
"format minor version": 0
},
...
}
When making compatible changes to the format (e.g., adding members to
JSON objects), only the minor version number should be increased.
Increase the major version number when a change is backward-incompatible
(such as the removal, renaming or semantic change of a member). Of
course, incompatible changes (like this one) should only be considered
as a last recourse.
- New methods Options::printJSONReport() and utility method
Options::OptionsPrivate::createJSONArrayFromPathList().
- Small addition to Options::processOptions(), since the --json-report
option must be processed *after* the TerraSync and download dirs, as
well as aircraft and scenery paths, have been finally set.
Apart from providing a public method giving a path to the autosave file,
the main idea of this commit is to reduce redundancy where
globals->get_fg_home() was so far used in every place where the autosave
file is needed or saved. Use an optional argument for
FGGlobals::loadUserSettings() and FGGlobals::saveUserSettings()[1],
since it should be exceptional to access an autosave file in another
location than $FG_HOME.
Also add comments explaining how to avoid security pitfalls with
saveUserSettings() (cf. discussion around
<https://sourceforge.net/p/flightgear/mailman/message/35461636/>).
[1] Argument *added* to this method, for consistency with
FGGlobals::loadUserSettings().
- The 'DatFilesGroupInfo' struct and 'DatFileType' enum are now public
members of 'NavDataCache'.
- New public method NavDataCache::getDatFilesInfo() returning the
'DatFilesGroupInfo' struct for a given type of dat files. For
instance, this allows one to retrieve the ordered list of apt.dat
files the NavCache would use if it were rebuilt at that time, as well
as their total size.
Similar to the existing FGGlobals::get/set_terrasync_dir(), add
FGGlobals::get_download_dir() and FGGlobals::set_download_dir() methods,
and of course the corresponding FGGlobals::download_dir public member
variable. FGGlobals::set_download_dir() stores the realpath() of the
given directory, including into the /sim/paths/download-dir property,
which is marked as read-only just as /sim/terrasync/scenery-dir already
is.
Handle the setup of the TerraSync and download dirs all in the same
place (Options::processOptions()), since most of the work is already
done there. This allows one to get rid of fgOptTerrasyncDir() and
fgOptDownloadDir(), and to make it easier to see that
globals->set_terrasync_dir() (resp. globals->set_download_dir()) is
called on the correct SGPath, regardless of whether --terrasync-dir
(resp. --download-dir) was passed.
Always create the TerraSync and download dirs when they don't already
exist, regardless of whether --terrasync-dir or --download-dir has been
given on the command line.
Add comments explaining how to avoid security pitfalls with download and
TerraSync dirs (cf. discussion around
<https://sourceforge.net/p/flightgear/mailman/message/35461636/>).
Adjust indentation where it was too broken, hampering readbility.
1) Paths and the FG_SCENERY paths list are now printed like:
FG_ROOT=/home/flo/flightgear/src/fgdata
instead of:
FG_ROOT=Path "/home/flo/flightgear/src/fgdata"
Moreover, FG_SCENERY is now correctly printed (without 'Path ""'
wrapping, without Terrain, Objects and markers instead of the actual
scenery paths) regardless of the position of --version relatively to
--fg-scenery, --terrasync-dir, etc. Of course, the values given to
these options do influence the output of --version.
Simplify printing of FG_SCENERY via SGPath::join() and use the
correct, OS-dependent separator between paths, SGPath::pathListSep.
Write the --version output to stdout, as already done for --help;
then it can be easily piped to $PAGER and doesn't get mixed with the
output of SG_LOG (which is on stderr). This is of course backward
incompatible for programs reading the stderr output of
'fgfs --version', but has been agreed upon on FlightGear-devel (cf.
<https://sourceforge.net/p/flightgear/mailman/message/35461619/>).
2) Don't write explicit values in the OptionResult enum: they don't
matter, but giving them is error-prone in case one does a copy-paste
to add a new member to the enum and forgets to change the value.
For some reason, g++ may see a 'skipws' I/O manipulator from the
standard library (depending on the order of includes...) when compiling
src/Navaids/poidb.cxx. This I/O manipulator is then in competition with
one with the same name defined in simgear/misc/sgstream.cxx. Use std::ws
to remove all ambiguity (std:skipws does something quite different!).
The new FGLight::updateObjects() function is now being passed into the global
events manager as a task rather than FGLight::updateSunPos(). The
updateSunPos() function has been renamed to updateBodyPos() and generalised for
any solar system body and is called twice by updateObjects(), once for the sun
and once for the moon. The local position of the moon is then exposed at
"/ephemeris/moon/local/".
This includes the moon's absolute position, age and phase. For this, the new
simgear MoonPos::get*() functions are tied to the property tree at
"/ephemeris/moon/" using a new tieMoonPos() function.
In addition the moon illumination factor is exposed by tying the simgear
MoonPos::getIlluminanceFactor() function to the /environment/moonlight property.
This is a number ranging between 0 and 1 based on the log of the illuminance of
the moon outside the atmosphere. It is calculated as
factor = (log(I) - max_loglux) / (max_loglux - min_loglux) + 1.0,
The illuminance of the moon outside the atmosphere, I, is from equation 20 from:
Krisciunas K. and Schaefer B.E. (1991). A model of the brightness of
moonlight, Publ. Astron. Soc. Pacif. 103(667), 1033-1039 (DOI:
http://dx.doi.org/10.1086/132921).
For more background, see
http://forum.flightgear.org/viewtopic.php?f=47&t=28201&start=60#p270516 .
The functions fgSunPositionGST() and fgTimeSecondsUntilSunAngle() have been
renamed to fgBodyPositionGST() and fgBodyPositionGST() respectively, and both
require a new char argument specifying the body of interest. This allows the
position of all solar system bodies to be calculated from the aircraft frame of
reference.
Move the existing aircraft history to a more obvious place, and follow
the same pattern for the complete location history. This makes restoring
a previously used configuration much simpler.
Of fast systems with 60fps sending many properties to web clients
may overrun the rendering capabilities of the browser. At some point
the web socket client halts the simulation by throtteling the network
connection.
Update rate is settable at startup setting to a double value
/sim/http/property-websocket/update-interval-secs
(default: 0.05 aka 20Hz)
Without this change, it would be possible that the NavCache is rebuilt
using $FG_ROOT/Airports/apt.dat (if $FG_ROOT/Airports/apt.dat.gz is
manually deleted) despite APTLoader::readAptDatFile() using
sg_gzifstream() with $FG_ROOT/Airports/apt.dat.gz, but the NavCache
would still contain a reference to $FG_ROOT/Airports/apt.dat.gz and log
messages would pretend we are reading this (non-existent) file.
Unrelated: the change
- "Loaded data for " << nbAirports << " airports" );
+ "Loaded data for " << nbLoadedAirports << " airports" );
has no incidence given the current code, but it is more logical and
future-proof (in case someone adds a continue statement inside the for
loop starting at line 224...).
It is not needed anymore to hardcode the number of lines of
$FG_ROOT/Airports/apt.dat.gz. The new method, which relies on
SGPath::sizeInBytes() and sg_gzifstream::approxOffset(), works as well
for the other dat files.
Add a new NavCache rebuild phase, REBUILD_READING_APT_DAT_FILES, since
the process is now made of two parts.
Rename NavDataCachePrivate::getDatFilesPaths() to
NavDataCachePrivate::findDatFiles(), because it now returns a
DatFilesGroupInfo (new struct) instead of a PathList. For the same
reason, rename NavDataCachePrivate::aptDatPaths to
NavDataCachePrivate::aptDatFilesInfo. Adapt signatures, etc.
This requires up-to-date SimGear and FGData.
Add checks to avoid read-past-vector-bounds errors.
Make the current line number in each apt.dat file available to methods
such as parseRunwayLine810(), parseRunwayLine850(), etc. for useful
error messages.
In APTLoader::parseCommLine():
- use 'rowCode' instead of 'lineId' for consistency with the apt.dat
spec and the rest of the code;
- use 'unsigned int' for the type since row codes are always
non-negative;
- add a missing 'return' statement and improve an error message.
Small optimization in APTLoader::parseAirportLine().
This will be clearer since it is a PositionedID and we are also dealing
with airport identifiers in the sense of the apt.dat spec in the same
class.
Rename 'line_id' to 'rowCode' in src/Airports/apt_loader.cxx
"Row code" is the expression consistently used for this number in the
apt.dat format spec. Since we already deal with airport *identifiers*,
this should make this piece of code easier to read.
For the same reason, rename the 'num' parameter of
APTLoader::parsePavementNodeLine850() to 'rowCode'.
- APTLoader::parseViewpointLine(): new method.
- APTLoader::parseViewpointLine(): check vector size to prevent
past-bounds reading.
More accurate signature for fptypeFromRobinType()
Row codes in the apt.dat spec are always non-negative -> take an
unsigned int instead of just an int.
Use an initialization list for remaining members of APTLoader::APTLoader()
This is slightly more efficient in general. Swap the order of
declarations for the 'cache' and 'currentAirportID' members of
APTLoader to have the initialization list in the same order as the
member declarations (cf. g++'s -Wreorder option and
<http://stackoverflow.com/questions/1828037/whats-the-point-of-g-wreorder>).
Fix detection of blank lines by APTLoader::isBlankOrCommentLine()
In
<https://sourceforge.net/p/flightgear/flightgear/merge-requests/39/#cea6>,
it was decided to let the main apt.dat line reading loop give out
"lines" that may end with '\r', because most of the downstream code will
automatically get rid of this character thanks to its use of
simgear::strutils::split(). However, APTLoader::isBlankOrCommentLine()
didn't detect blank lines properly due to that trailing '\r', which
could cause bad behavior because the subsequent atoi() call could return
anything from a string containing only whitespace (the "anything" in
question being then interpreted as an apt.dat row code...).
Add method APTLoader::cleanLine()
This method returns a copy of the input line with trailing '\r' char(s)
removed.
APTLoader::loadAirports(): clean message when finding an unknown row code
The start of the log message could previously be overwritten by later
text because of the '\r' at the end of input lines (now obtained from
APTLoader::readAptDatFile()). Quite confusing! Use the new
APTLoader::cleanLine() to prevent this from happening.
It is now allowed to have the same airport appear in several apt.dat
files ($scenery_path/NavData/apt/*.dat[.gz] for each scenery path, plus
the default $FG_ROOT/Airports/apt.dat.gz, coming last). Airports found
in earlier files(*) take precedence over those found later, in case
several apt.dat files define the same airports. Airports that are
skipped due to this mechanism are logged with
SG_LOG(SG_GENERAL, SG_INFO, ...).
(*) using 1) FG_SCENERY order (followed by $FG_ROOT/Airports/apt.dat.gz)
and 2) lexicographic order inside each $scenery_path/NavData/apt
folder
With this commit, APTLoader::parseAPT() is replaced by two methods:
readAptDatFile() and loadAirports():
- APTLoader::readAptDatFile() reads airport definitions from an
apt.dat file into APTLoader's 'airportInfoMap' member variable,
discarding duplicate definitions due to overlapping apt.dat files
('airportInfoMap' is an std::unordered_map instance in C++11 and
later, an std::map otherwise);
- APTLoader::loadAirports() reads each airport definition from
'airportInfoMap' and loads it into the NavCache, the same way as
APTLoader::parseAPT() used to do.
The airportDBLoad() function is not useful anymore, and is thus removed
(in NavDataCache::doRebuild(), APTLoader::readAptDatFile() is now called
once per apt.dat file, but APTLoader::loadAirports() is only called
once at the end, after duplicate airports have been discarded; the class
interface is much better suited to this scheme, because it can cleanly
retain the state between these calls).
By the way, this commit fixes an old bug: APTLoader's member variable
'last_apt_id' was used in several places but never assigned to, except
in APTLoader::APTLoader() as the empty string.
Thanks to Alan Teeder for his feedback and testing.
Load every file matching the pattern NavData/apt/*.dat[.gz] inside each
scenery path. These files are loaded in the same order as the components
of globals->get_unmangled_fg_scenery() they reside in. Inside a given
component, the order is determined by pathSortPredicate() in
simgear/misc/sg_dir.cxx (lexicographic order at the time of this
writing). For compatibility with existing scenery,
$FG_ROOT/Airports/apt.dat.gz is also loaded last.
The idea is that such files will have the same precedence order as the
globals->get_unmangled_fg_scenery() scenery components they come from.
This commit doesn't handle this fully yet, though: it blindly loads all
these files. A future commit will ensure that no airport is loaded twice
due to overlapping apt.dat files. This commit however handles all the
logic of navdata cache rebuilding when the list, the order of apt.dat
files, or any of their timestamps changes.
Although only apt.dat files receive a new treatment in this commit, the
changes to NavDataCache.[ch]xx are already generic so that extension of
this method to fix.dat, nav.dat, etc. will require almost no change to
NavDataCache.[ch]xx (however, changes will probably be needed in the
various loaders: in fixlist.[ch]xx, navdb.[ch]xx, etc.).
src/Navaids/CacheSchema.h:
- increment the SCHEMA_VERSION by 1. This ensures among others that if
someone uses a FlightGear version posterior to this change with
new-style scenery (having NavData/apt/*.dat[.gz] files inside
scenery paths), then goes back to a FlightGear version anterior to
this change, his NavCache is rebuilt ignoring the in-scenery-paths
NavData/apt/*.dat[.gz] files, as expected with the old FlightGear
version.
src/Navaids/NavDataCache.cxx:
- NavDataCachePrivate: replace aptDatPath (SGPath) with aptDatPaths
(PathList).
- NavDataCachePrivate::getDatFilesPaths(): new method that returns the
list of $scenery_path/NavData/<type>/*.dat[.gz] files found inside
scenery paths (where <type> is one of 'apt', 'fix', etc.), plus the
historical file (e.g., $FG_ROOT/Airports/apt.dat.gz for the 'apt'
type).
- NavDataCachePrivate::areDatFilesModified(): new method that tells
whether any of these files (for a given type) has changed since the
last NavCache rebuild, or if their ordered list has changed.
- NavDataCachePrivate::isCachedFileModified(): minor changes.
- NavDataCache::updateListsOfDatFiles(): new method that updates the
lists of dat files used for NavCache freshness checking and
rebuilding, i.e. currently sets/updates d->aptDatPaths using the new
method d->getDatFilesPaths(), and d->metarDatPath, d->navDatPath,
d->fixDatPath, d->poiDatPath, etc. as usual. This method will be
useful for instance in the built-in launcher after updating scenery
paths and before calling NavDataCache::isRebuildRequired().
- NavDataCache::NavDataCache(): use
NavDataCache::updateListsOfDatFiles() to initialize d->aptDatPaths,
d->metarDatPath, d->navDatPath, d->fixDatPath, d->poiDatPath, etc.
- NavDataCache::isRebuildRequired(): use
NavDataCachePrivate::areDatFilesModified() instead of just checking
$FG_ROOT/Airports/apt.dat.gz.
- NavDataCache::doRebuild(): load all apt.dat files listed in
d->aptDatPaths, instead of only $FG_ROOT/Airports/apt.dat.gz. Write
their ordered list and timestamps in the NavCache.
src/Navaids/NavDataCache.hxx:
- declare the new method NavDataCache::updateListsOfDatFiles().
- NavDataCache::DatFileType: new enum with values DATFILETYPE_APT,
DATFILETYPE_METAR, DATFILETYPE_AWY, DATFILETYPE_NAV,
DATFILETYPE_FIX, DATFILETYPE_POI, DATFILETYPE_CARRIER and
DATFILETYPE_TACAN_FREQ. Maybe some of the corresponding files won't
have to be moved to scenery paths, but simply listing them in the
enum doesn't change how they are dealt with. Those for which
per-scenery-path locations doesn't make sense can just be removed
from the enum.
- NavDataCache::datTypeStr: new static string_list giving an
std::string such as 'apt' for each value of the
NavDataCache::DatFileType enum.
- NavDataCache::defaultDatFile: new static string_list giving a path
(relative to $FG_ROOT) to the historical/default file for each value
of the NavDataCache::DatFileType enum.
src/Airports/apt_loader.cxx and src/Airports/apt_loader.hxx:
- always include a path to the apt.dat file being processed in log
messages, since they can now apply to many files;
- be clearer about code 99: it should normally be at the end of
apt.dat files, but technically, it is not an EOF;
- use the expression "row code" consistently with the apt.dat format
spec (for now: only in places where there is another change to do).
src/GUI/QtLauncher.cxx and src/GUI/QtLauncher_private.hxx:
- turn QtLauncher::setSceneryPaths() into a static method and call it
in runLauncherDialog() before instantiating NavDataCache, so that
NavDataCache::updateListsOfDatFiles() (called from NavDataCache's
constructor) can see all configured scenery paths.
This will avoid problems in case stampCacheFile() or
isCachedFileModified() is passed a relative path, or a path containing
.. components, etc. Among others, it ensures the stat_cache table only
contains absolute paths.
NavDataCache: read and write methods preserving order for string list props
New methods: NavDataCache::readOrderedStringListProperty() and
NavDataCache::writeOrderedStringListProperty().
add missing includes; proper interface for the APTLoader class
remove unused members 'last_apt_info' and 'token'
The APTLoader methods defined in src/Airports/apt_loader.cxx are now at
top level instead of being inside a 'class' definition block, therefore
they don't have to be indented anymore.
APTLoader::throwExceptionIfStreamError(): better API and implementation
- loadFixes() becomes FixesLoader::loadFixes();
- the previous 'cache' variable (NavDataCache *) is now a private member
of FixesLoader, named '_cache'.
- Line numbering was incorrect, because "in >> lat >> lon >> ident;"
happily skipped over blank lines without increasing the line number.
- Safe stream input handling: first, std::getline() tries to read data,
then we check whether that was successful (via the input stream's
bool() method, implicitly called in the 'for' loop's exit check), and
only if this is the case, we process the data that was read. The main
problem with the previous code is that checking the stream's eofbit
can't possibly predict whether a _future_ read will be successful---it
may fail due to an I/O error, at least.
- Currently, the code uses atof() to parse the latitude and longitude
fields. This should be fast, though not good at detecting errors in
the input; however, this is not worse than the previous code which
didn't handle such cases at all.
- Correctly deal with input lines containing a number of fields
different from 3 (except for the header and the special '99' line):
log a warning, ignore the line and continue. This adresses the problem
described in
<https://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/87shydeen1.fsf%40frougon.crabdance.com/#msg35034274>.
In short, the previous code entered an endless loop trying to process
31.815914 -106.281897 EL PA
from recent earth_fix.dat
(obtained from <http://gateway.x-plane.com/navaids/LatestNavFix.zip>).
Expand existing —-config option to read either property-XML files (as
it previously did) but for non-XML files, to parse them as command
line argument files.
Bypass the options system to set location from the launcher; this
allows the same code to be used in-sim for repositioning, while
keeping compatibility with other repositions approaches.
With Simgear commit d7d59b08a2f1a77a4247ec1a89d6ff48ed73f5c7, this
allows terrasync to be initialised from files in the install data,
which avoids downloading them again.
Relocate the start-up position to a plausible hold-short position
when MP is active and a runway start is requested. This does not (yet)
use ground-net data to identify a real hold-short position.
when active does not touch the way the YASim jet calculates fuel flow, but separates out the afterburning component of thrust, calculates the TSFC of that component and uses the same method of fuel flow calculation for the afterburning component then adds it to the existing fuel flow
When inactive (atsfc doesn't exist or is zero) it just behaves exactly as before
I finally got around to testing this small patch thoroughly, and I'm satisfied that it doesn't affect anything else & works across many different versions (i've been testing it with current as it has changed over the last 7 months)
* Fixed the initial conditions settings (geodetic altitude is now correctly computed).
* FGLGear reports the time at which it detected a violent ground hit (aka crash)
* Doc update of the kinematic component
* TurboProp code cleanup with the removal of lots of obsolete/no-op members.
Remove uses of .str(), .c_str() and some other methods of SGPath.
Pass SGPath directly where possible, or explicitly convert to the
appropriate 8-bit encoding.
* Fixed the trim on ground algorithm. Now JSBSim aircrafts should no longer be 'dropped' on the runway at start.
* Removed a correction on the propeller induced velocity that was giving erratic results when the aircraft aero velocity is very small.
* Various source comments updates.
Tolerate the case where a URL matching the exact FG version is
not found; lookup a generic URL, in the hope it supports our
version (additional changes will make this more likely)
The precipitation branch of the OSG scene graph is now centrally managed by the
scenery manager rather the precipitation manager itself. The scene graph
initialisation from the constructor has also been shifted into the new
FGPrecipitationMgr::sceneGraphSetup() function.
As the scenery manager's init() function is called twice on start up, two OSG
scene graph roots would be created. A number of scene graph branches would be
initalised on the first root, but then be lost as the second is created. This
fixes the precipitation branch, for example.
- The first place where indentation is fixed was really misleading, at
least.
- The added comment "'line' may end with an \r character [...]" just
clarifies something that has been there for ages, to avoid people
falling into the trap.
- don't duplicate the line buffer (array of char as well as
std::string), it is not useful here;
- don't corrupt (truncate) input lines longer than 2048 bytes: there is
no such limitation in the apt.dat v1000 format spec;
- fix comments handling: the apt.dat v1000 format spec states they must
start with *two* '#' characters.
- The first two lines of apt.dat have their own special syntax -> handle
them separately. Before this commit, the test "is the first character
an 'I' or an 'A'?" was done for *every* line of apt.dat, while it is
only relevant for the first one.
- Fix counting of the current line number (it was most of the time
0-based so far, which could be seen in error messages, because the
second line of apt.dat was absorbed without going through the common
code path where lines are normally read at the top of the while loop).
With this commit, line numbers in apt.dat are consistently counted
starting from 1.
Remove useless code before parsing the "row code" (terminology from the
apt.dat v1000 spec). The row code is parsed with atoi(), which will
automatically stop at the first space found if it saw at least one
digit, thus there is no need to replace it with '\0', AFAICS.
One could replace the existing atoi() call with things that do better
checking, but my tests showed that would be a bit slower, so I let it
this way (tried with std::istringstream and strtol()).
When using live weather fetch, the QNH should be obtained from
environment/metar/pressure-inhg.
See: http://sourceforge.net/p/flightgear/mailman/message/35037125
Add new method getQnhInHg to ATISInformationProvider and its implementations
to avoid rounding errors converting from hPa back to inches in ATIS reports.
The CurrentWeatherATISInformationProvider (used when live weather fetch is
not in use) continues to use the property environment/pressure-sea-level-inhg.
This produces the incorrect QNH at airports significantly above sea level
but this needs fixing elsewhere to calculate the correct QNH.
- Add section tag to support inclusion of ATIS fragments.
- Add visibility, QNH and cloud tokens to support new ATIS formats.
- Add support for starts-with, ends-with and contains comparisons in
conditionals, including negated versions.
- Strip and convert case in comparisons.
- Speak VRB wind direction as "variable".
- Speak zeroes in fractional part of QNH inHg.
- Force US voice in US, Canada and Pacific; UK voice in UK.
------------------------------------------------------------------------
If no aircraft is selected in the launcher, the routine
AircraftItemModel::indexOfAircraftURI is called with an empty QUri,
triggering a warning in the terminal.
This commit removes such warning by ignoring QUris with empty schemes
(the routine still returns an invalid index).
Prior to this change, it was only possible to compare the values of tokens
to each other for use in conditionals, e.g. landing and departing runway.
This change allows comparison of a token to a text value, e.g. to compare
wind speed to zero.
osg::texture2D changes GL_UNPACK_ROW_LENGTH, which fntLoadTXF is not
prepared to deal with. Reset the value back to 0 before loading +
caching TXF fonts on the PLIB side.
When set on the command line, will be used for aircraft packages. When
set in the Qt launcher, will also be used for aircraft downloads at
all times.
When changing the path in the launcher, the set of aircraft catalogs
is refresh automatically. Note the default catalog may need to be
re-installed.
The --metar option has no effect unless --disable-real-weather-fetch is
also passed. This often makes users believe that --metar doesn't work.
Change the implementation for --metar so that it automatically implies
--disable-real-weather-fetch.
After removing /Models from FGData loading of shared models from
within a scenery model failed because the ResourceManager did not know
about additional scenery paths.
- Only clear the OSG ‘pose as standalone’ flag when we really show
a dialog, as opposed to when we /might/ show.
Tested:
- Qt build using launcher
- No Qt build
- Qt build but launcher not requested
This patch may introduce an occasional crash on exit again, because it effectively undoes commit [a972df]. I'll try to find a better fix for that later on.
- work in progress, goal is to make copyToCurrent and most of
the bind/unbind logic sink into each specific View, avoiding all the
null pointer checks in view manager.
The problem was that the change to make FGScenery a standard subsystem caused
the particle OSG group to no longer be inserted into the scene graph. The
solution was to convert the particle group to be set up as a standard branch of
the scene graph, alongside the terrain, models, aircraft, and interior branches.
The particle system is now set up as part of the init() subsystem function call,
so it is compatible with the new subsystem design.
This follows from http://thread.gmane.org/gmane.games.flightgear.devel/78650 and
resolves the sign bug https://sourceforge.net/p/flightgear/codetickets/1778/ .
Combined with a matching change to FGData, this changes the HUD formats from the
current set of 3 (note that the text in brackets is not shown in the HUD
preferences PUI dialog, but is show here for reference):
0) Decimal degrees (37.618890N -122.375000W)
1) Degrees, minutes (37*37.133N -122*22.500W)
2) Degrees, minutes, seconds (37*37 08.0 N -122*22 30.0 W)
to (here the text in brackets will be shown in the PUI dialog):
0) DDD format (37.618890N 122.375000W)
1) DMM format (37*37.133'N 122*22.500'W)
2) DMS format (37*37'08.0"N 122*22'30.0"W)
3) Signed DDD format (37.618890 -122.375000)
4) Signed DMM format (37*37.133' -122*22.500')
5) Signed DMS format (37*37'08.0" -122*22'30.0")
6) Zero padded DDD (51.477500N 000.461389W)
7) Zero padded DMM (51*28.650'N 000*27.683'W)
8) Zero padded DMS (51*28'39.0"N 000*27'41.0"W)
9) Trinity House Navigation (51* 28'.650N 000* 27'.683W)
Being able to list arbitrary directories is a privacy violation;
existing in-fgdata uses of this are all permitted paths
(i.e. not Terrasync; FileSelector doesn't use it)
- Use setlocale() to ensure consistent handling of locales and
string handling irrespective of whether or not QCoreApplication
is invoked. Forces a the C locale for numerics and collation,
since many pieces of FG assume this.
I didn’t know about this feature when doing the original CMake files,
we can use this to target header-file includes more precisely.
(Probably more cases exist that can be changed from global to target-
specific includes)
- add a button to the main dialog, explaining how to adjust the
fg-root path via the GUI
- tweak the GUI flow to support explicitly changing the path even
when the default path is acceptable.
- because uiuc_warning_error always called exit(-1), it can be marked
no return, so Clang realises that when it’s used in the ‘else’
side of a parsing test, uninitialised variables in the enclosing
call site are safe.
(Requires Simgear update to define SG_NO_RETURN helper)
- when dynamics shuts down the ATC controllers, they clear their
traffic vectors (destroying the records), but we didn’t notify
the AI aircraft of this. Ensure the controller is cleared so
the AI aircraft shutdown doesn’t crash.
Under some conditions on my system
aircraft_paths.begin() was equal to scenery_paths.end()
This resulted in neither of them being added to read_allowed_paths
followed by failure to load Nasal scripts from the aircraft directory.
This might happen, if scenery_paths gets allocated just before aircraft_paths
in memory.
Better loop across the desired lists instead of using fancy tricks with
the iterator.
- sim-speed-up (a/A keys) offsets warp correctly. This means at 4x speed
up the warp will increase by 3 seconds for one elapsed real second.
In practice this means simulation elements timed using sim ‘current time’
will be correctly synchronised with those using simulated elapsed time.
(AI traffic being a prime example of this)
- warp-delta (t/T keys) is independent of frame rate, and works when
paused. The warp-delta values in the keybindings / GUI dialog
will need to be updated since warp-delta in now seconds-per-second,
as opposed to seconds-per-frame.
- change launcher to examine the scenery paths and hence load
ground-net files for airports to populate parking data.
- refactor ground-net XML parsing to use FGGroundNetwork only, not
AirportDynamics.
- change parenting of GroundNetwork to Airport, since it contains
immutable data now.
- when no runway use preferences XML exists, be smarter about using
available runways. Makes the common case of using two parallel
runways for arrivals and departures work, greatly improving AI
traffic behaviour.