Fix scenery reload issues.
Aircraft could fall through the ground on scenery reload. Properly reset the "sceneryloaded" flag to pause FDM processing while scenery is being reloaded. Also stop processing some instruments while scenery is reloaded.
This commit is contained in:
parent
43f7ebcb35
commit
9effb06047
6 changed files with 18 additions and 31 deletions
src
|
@ -102,14 +102,9 @@ agRadar::init ()
|
|||
void
|
||||
agRadar::update (double delta_time_sec)
|
||||
{
|
||||
if ( ! _sim_init_done ) {
|
||||
|
||||
if ( ! fgGetBool("sim/sceneryloaded", false) )
|
||||
if (!_sceneryLoaded->getBoolValue())
|
||||
return;
|
||||
|
||||
_sim_init_done = true;
|
||||
}
|
||||
|
||||
if ( !_odg || ! _serviceable_node->getBoolValue() ) {
|
||||
_Instrument->setStringValue("status","");
|
||||
return;
|
||||
|
@ -122,7 +117,6 @@ agRadar::update (double delta_time_sec)
|
|||
|
||||
_time = 0.0;
|
||||
|
||||
|
||||
update_terrain();
|
||||
// wxRadarBg::update(delta_time_sec);
|
||||
}
|
||||
|
|
|
@ -97,30 +97,23 @@ radAlt::init ()
|
|||
void
|
||||
radAlt::update (double delta_time_sec)
|
||||
{
|
||||
if ( ! _sim_init_done ) {
|
||||
|
||||
if ( ! fgGetBool("sim/sceneryloaded", false) )
|
||||
if (!_sceneryLoaded->getBoolValue())
|
||||
return;
|
||||
|
||||
_sim_init_done = true;
|
||||
}
|
||||
|
||||
if ( !_odg || ! _serviceable_node->getBoolValue() ) {
|
||||
_Instrument->setStringValue("status","");
|
||||
return;
|
||||
}
|
||||
|
||||
_time += delta_time_sec;
|
||||
|
||||
if (_time < _interval)
|
||||
return;
|
||||
|
||||
_time = 0.0;
|
||||
|
||||
update_altitude();
|
||||
}
|
||||
|
||||
|
||||
|
||||
double
|
||||
radAlt::getDistanceAntennaToHit(SGVec3d nearestHit) const
|
||||
{
|
||||
|
|
|
@ -77,7 +77,6 @@ wxRadarBg::wxRadarBg(SGPropertyNode *node) :
|
|||
_interval(node->getDoubleValue("update-interval-sec", 1.0)),
|
||||
_elapsed_time(0),
|
||||
_persistance(0),
|
||||
_sim_init_done(false),
|
||||
_odg(0),
|
||||
_range_nm(0),
|
||||
_scale(0),
|
||||
|
@ -127,6 +126,7 @@ void
|
|||
wxRadarBg::init ()
|
||||
{
|
||||
_serviceable_node = _Instrument->getNode("serviceable", true);
|
||||
_sceneryLoaded = fgGetNode("/sim/sceneryloaded", true);
|
||||
|
||||
// texture name to use in 2D and 3D instruments
|
||||
_texture_path = _Instrument->getStringValue("radar-texture-path",
|
||||
|
@ -287,22 +287,17 @@ osg::Matrixf wxRotate(float angle)
|
|||
void
|
||||
wxRadarBg::update (double delta_time_sec)
|
||||
{
|
||||
if (!_sim_init_done) {
|
||||
if (!fgGetBool("sim/sceneryloaded", false))
|
||||
if (!_sceneryLoaded->getBoolValue())
|
||||
return;
|
||||
|
||||
_sim_init_done = true;
|
||||
}
|
||||
if (!_odg || !_serviceable_node->getBoolValue()) {
|
||||
_Instrument->setStringValue("status", "");
|
||||
return;
|
||||
}
|
||||
|
||||
_time += delta_time_sec;
|
||||
if (_time < _interval){
|
||||
// cout << "WXradar update too soon " << _time << endl;
|
||||
if (_time < _interval)
|
||||
return;
|
||||
}
|
||||
// cout << "WXradar updating" << _time<< endl;
|
||||
|
||||
_time = 0.0;
|
||||
|
||||
|
|
|
@ -57,9 +57,9 @@ protected:
|
|||
double _interval;
|
||||
double _elapsed_time;
|
||||
double _persistance;
|
||||
bool _sim_init_done;
|
||||
|
||||
SGPropertyNode_ptr _serviceable_node;
|
||||
SGPropertyNode_ptr _sceneryLoaded;
|
||||
SGPropertyNode_ptr _Instrument;
|
||||
SGPropertyNode_ptr _radar_mode_control_node;
|
||||
|
||||
|
|
|
@ -1612,8 +1612,8 @@ FGRenderer::update( ) {
|
|||
if (_splash_alpha->getDoubleValue()>0.0)
|
||||
{
|
||||
// Fade out the splash screen
|
||||
const double fade_time = 0.8;
|
||||
const double fade_steps_per_sec = 20;
|
||||
const double fade_time = 0.5;
|
||||
const double fade_steps_per_sec = 10;
|
||||
double delay_time = SGMiscd::min(fade_time/fade_steps_per_sec,
|
||||
(SGTimeStamp::now() - _splash_time).toSecs());
|
||||
_splash_time = SGTimeStamp::now();
|
||||
|
|
|
@ -101,6 +101,11 @@ void FGTileMgr::refresh_tile(void* tileMgr, long tileIndex)
|
|||
|
||||
void FGTileMgr::reinit()
|
||||
{
|
||||
// reset flag, stop FDM processing, otherwise aircraft fall through
|
||||
// the ground while reloading scenery
|
||||
fgSetBool("/sim/sceneryloaded",false);
|
||||
fgSetDouble("/sim/startup/splash-alpha", 1.0);
|
||||
|
||||
// remove all old scenery nodes from scenegraph and clear cache
|
||||
osg::Group* group = globals->get_scenery()->get_terrain_branch();
|
||||
group->removeChildren(0, group->getNumChildren());
|
||||
|
|
Loading…
Add table
Reference in a new issue