|
From: PlayeRom R. L. <rom...@pl...> - 2023-07-21 23:15:05
|
Okay, I sent two merge requests with the update according to your instructions: https://sourceforge.net/p/flightgear/fgdata/merge-requests/311/ https://sourceforge.net/p/flightgear/flightgear/merge-requests/320/ The only thing I couldn't eliminate was the use of fgGetBool in the constructor of FGEnvironment: FGEnvironment::FGEnvironment() : is_isa(fgGetBool("/environment/atmosphere/is-isa", false)) { _init(); } At first I thought it was enough to set is_isa = false; in the FGEnvironment::_init() method. But then, even though the setter set the is_isa flag to true, it was returned to false by the FGEnvironment copy constructor. From what I checked, the FGEnvironment copy constructor is run every frame of the animation. The normal FGEnvironment constructor only runs once, so I hope it won't be a big deal? Unless there is a better solution to initialize the is_isa flag? W dniu 21.07.2023 o 12:02, James Turner pisze: > >> On 20 Jul 2023, at 16:03, PlayeRom Roman Ludwicki<rom...@pl...> wrote: >> >> Nothing from me > > We need to do a bit of re-design on this: it’s going to cause issues to check specific non-C++ controlled properties inside _recalc_sl_temperature (check if local weather s on/off and the weather scenario name). > > We try to avoid using fgGetXYZ anywhere called more than once, and also we want to avoid making C++ code which breaks if Nasal is changed, which means we can’t read properties which are created by Nasal code to make simulation decision, usually. > > Instead I’d propose we add instead a flag property, something like ‘atmosphere/is-isa’, and Tie this in FGEnvironment::Tie, and then map it to an internal bool (eg, bool _isISA in FGEnvironment.hxx), via new methods get_is_isa_atmosphere / set_is_isa_atmosphere in FGEnvironment. Then your if() test in _recalc_sl_temperature simply becomes a check of that bool value to decide which temperature calculation to use, no more use of fgGetBool / fgGetString. > > For this this to work, we would then adjust the listener callback in weather_scenarios.nas to check the local-weather / scenario-name values and update the value of /environment/atmosphere/is-isa accordingly. > > Hopefully that all makes sense : let me know if anything is unclear or if you need assistance with it. > > Kind regards, > James > > > > _______________________________________________ > Flightgear-devel mailing list > Fli...@li... > https://lists.sourceforge.net/lists/listinfo/flightgear-devel -- Pozdrawiam Roman Ludwicki |