1
0
Fork 0

Remove static property dependencies

preventing us from wiping properties on reset/reinit/subsystem recreate.
(more work required for "native_gui" and "ATC-Outputs" protocols)
This commit is contained in:
ThorstenB 2012-11-18 16:35:54 +01:00
parent 1f1dd1fa16
commit a784443a24
28 changed files with 151 additions and 152 deletions

View file

@ -48,6 +48,8 @@ void FGATCManager::init() {
int leg = 0;
trans_num = globals->get_props()->getNode("/sim/atc/transmission-num", true);
// find a reasonable controller for our user's aircraft..
// Let's start by working out the following three scenarios:
// Starting on ground at a parking position
@ -259,8 +261,7 @@ void FGATCManager::update ( double time ) {
//string airport = fgGetString("/sim/presets/airport-id");
//FGAirport *apt = FGAirport::findByIdent(airport);
// AT this stage we should update the flightplan, so that waypoint incrementing is conducted as well as leg loading.
static SGPropertyNode_ptr trans_num = globals->get_props()->getNode("/sim/atc/transmission-num", true);
int n = trans_num->getIntValue();
int n = trans_num->getIntValue();
if (n == 1) {
//cerr << "Toggling ground network visibility " << networkVisible << endl;
networkVisible = !networkVisible;

View file

@ -52,6 +52,7 @@ private:
FGATCController *controller, *prevController; // The ATC controller that is responsible for the user's aircraft.
bool networkVisible;
bool initSucceeded;
SGPropertyNode_ptr trans_num;
public:
FGATCManager();
@ -61,4 +62,4 @@ public:
void update(double time);
};
#endif // _ATC_MRG_HXX_
#endif // _ATC_MRG_HXX_

View file

@ -286,14 +286,4 @@ void FGATCDialogNew::update(double dt) {
} else {
_gui->showDialog(dialog_name);
}
//dialogVisible = !dialogVisible;
return;
/*
static SGPropertyNode_ptr trans_num = globals->get_props()->getNode("/sim/atc/transmission-num", true);
int n = trans_num->getIntValue();
if (n >= 0) {
trans_num->setIntValue(-1);
// PopupCallback(n);
cerr << "Selected transmission message" << n << endl;
} */
}

View file

@ -1190,7 +1190,7 @@ bool FGStartupController::checkTransmissionState(int st, time_t now, time_t star
if ((msgDir == ATC_AIR_TO_GROUND) && isUserAircraft(i->getAircraft())) {
//cerr << "Checking state " << st << " for " << i->getAircraft()->getCallSign() << endl;
static SGPropertyNode_ptr trans_num = globals->get_props()->getNode("/sim/atc/transmission-num", true);
SGPropertyNode_ptr trans_num = globals->get_props()->getNode("/sim/atc/transmission-num", true);
int n = trans_num->getIntValue();
if (n == 0) {
trans_num->setIntValue(-1);

View file

@ -567,7 +567,7 @@ bool FGGroundNetwork::checkTransmissionState(int minState, int maxState, Traffic
if ((state >= minState) && (state <= maxState) && available) {
if ((msgDir == ATC_AIR_TO_GROUND) && isUserAircraft(i->getAircraft())) {
//cerr << "Checking state " << state << " for " << i->getAircraft()->getCallSign() << endl;
static SGPropertyNode_ptr trans_num = globals->get_props()->getNode("/sim/atc/transmission-num", true);
SGPropertyNode_ptr trans_num = globals->get_props()->getNode("/sim/atc/transmission-num", true);
int n = trans_num->getIntValue();
if (n == 0) {
trans_num->setIntValue(-1);

View file

@ -328,6 +328,7 @@ FGJSBsim::FGJSBsim( double dt )
ab_brake_left_pct = fgGetNode("/autopilot/autobrake/brake-left-output", true);
ab_brake_right_pct = fgGetNode("/autopilot/autobrake/brake-right-output", true);
altitude = fgGetNode("/position/altitude-ft");
temperature = fgGetNode("/environment/temperature-degc",true);
pressure = fgGetNode("/environment/pressure-inhg",true);
pressureSL = fgGetNode("/environment/pressure-sea-level-inhg",true);
@ -1006,7 +1007,6 @@ bool FGJSBsim::ToggleDataLogging(bool state)
//Positions
void FGJSBsim::set_Latitude(double lat)
{
static SGConstPropertyNode_ptr altitude = fgGetNode("/position/altitude-ft");
double alt = altitude->getDoubleValue();
double sea_level_radius_meters, lat_geoc;

View file

@ -271,6 +271,7 @@ private:
SGPropertyNode_ptr wing_fold_pos_pct;
SGPropertyNode_ptr tailhook_pos_pct;
SGConstPropertyNode_ptr altitude;
SGPropertyNode_ptr temperature;
SGPropertyNode_ptr pressure;
SGPropertyNode_ptr pressureSL;

View file

@ -166,7 +166,7 @@ void FGLaRCsim::update( double dt ) {
fgSetDouble("/engines/engine/running", eng.getRunningFlag());
fgSetDouble("/engines/engine/cranking", eng.getCrankingFlag());
static const SGPropertyNode *fuel_freeze
const SGPropertyNode *fuel_freeze
= fgGetNode("/sim/freeze/fuel");
if ( ! fuel_freeze->getBoolValue() ) {
@ -237,7 +237,7 @@ void FGLaRCsim::update( double dt ) {
fgSetDouble("/engines/engine/running", eng.getRunningFlag());
fgSetDouble("/engines/engine/cranking", eng.getCrankingFlag());
static const SGPropertyNode *fuel_freeze
const SGPropertyNode *fuel_freeze
= fgGetNode("/sim/freeze/fuel");
if ( ! fuel_freeze->getBoolValue() ) {

View file

@ -274,14 +274,7 @@ void uiuc_gear()
clear3(f_wheel_local_v);
reaction_normal_force=0;
#if 0
static const SGPropertyNode * gear_wow
= fgGetNode("/gear/gear[0]/wow", false);
static const SGPropertyNode * gear_wow1
= fgGetNode("/gear/gear[1]/wow", false);
static const SGPropertyNode * gear_wow2
= fgGetNode("/gear/gear[2]/wow", false);
#endif
fgSetBool("/gear/gear[0]/wow", false);
fgSetBool("/gear/gear[1]/wow", false);
fgSetBool("/gear/gear[2]/wow", false);

View file

@ -230,12 +230,11 @@ void fgHiResDump()
char *filename = new char [24];
static int count = 1;
static const SGPropertyNode *master_freeze
= fgGetNode("/sim/freeze/master");
SGPropertyNode *master_freeze = fgGetNode("/sim/freeze/master");
bool freeze = master_freeze->getBoolValue();
if ( !freeze ) {
fgSetBool("/sim/freeze/master", true);
master_freeze->setBoolValue(true);
}
fgSetBool("/sim/menubar/visibility", false);
@ -416,7 +415,7 @@ void fgHiResDump()
fgSetBool("/sim/menubar/visibility", menu_status);
if ( !freeze ) {
fgSetBool("/sim/freeze/master", false);
master_freeze->setBoolValue(false);
}
}
#endif // #if defined( TR_HIRES_SNAP)
@ -558,11 +557,11 @@ bool fgDumpSnapShot ()
return GUISnapShotOperation::start();
#else
// obsolete code => remove when new code is stable
static SGConstPropertyNode_ptr master_freeze = fgGetNode("/sim/freeze/master");
SGPropertyNode_ptr master_freeze = fgGetNode("/sim/freeze/master");
bool freeze = master_freeze->getBoolValue();
if ( !freeze ) {
fgSetBool("/sim/freeze/master", true);
master_freeze->setBoolValue(true);
}
int mouse = fgGetMouseCursor();
@ -614,7 +613,7 @@ bool fgDumpSnapShot ()
fgSetMouseCursor(mouse);
if ( !freeze ) {
fgSetBool("/sim/freeze/master", false);
master_freeze->setBoolValue(false);
}
return result;
#endif
@ -627,12 +626,11 @@ void fgDumpSceneGraph()
string message;
static int count = 1;
static const SGPropertyNode *master_freeze
= fgGetNode("/sim/freeze/master");
SGPropertyNode *master_freeze = fgGetNode("/sim/freeze/master");
bool freeze = master_freeze->getBoolValue();
if ( !freeze ) {
fgSetBool("/sim/freeze/master", true);
master_freeze->setBoolValue(true);
}
while (count < 1000) {
@ -658,7 +656,7 @@ void fgDumpSceneGraph()
delete [] filename;
if ( !freeze ) {
fgSetBool("/sim/freeze/master", false);
master_freeze->setBoolValue(false);
}
}
@ -670,12 +668,11 @@ void fgDumpTerrainBranch()
string message;
static int count = 1;
static const SGPropertyNode *master_freeze
= fgGetNode("/sim/freeze/master");
SGPropertyNode *master_freeze = fgGetNode("/sim/freeze/master");
bool freeze = master_freeze->getBoolValue();
if ( !freeze ) {
fgSetBool("/sim/freeze/master", true);
master_freeze->setBoolValue(true);
}
while (count < 1000) {
@ -701,26 +698,22 @@ void fgDumpTerrainBranch()
delete [] filename;
if ( !freeze ) {
fgSetBool("/sim/freeze/master", false);
master_freeze->setBoolValue(false);
}
}
void fgPrintVisibleSceneInfoCommand()
{
static const SGPropertyNode *master_freeze
= fgGetNode("/sim/freeze/master");
SGPropertyNode *master_freeze = fgGetNode("/sim/freeze/master");
bool freeze = master_freeze->getBoolValue();
if ( !freeze ) {
fgSetBool("/sim/freeze/master", true);
master_freeze->setBoolValue(true);
}
flightgear::printVisibleSceneInfo(globals->get_renderer());
if ( !freeze ) {
fgSetBool("/sim/freeze/master", false);
master_freeze->setBoolValue(false);
}
}

View file

@ -184,7 +184,7 @@ HeadingIndicatorDG::update (double dt)
// calculate the difference between the indicated heading
// and the selected heading for use with an autopilot
static SGPropertyNode *bnode
SGPropertyNode *bnode
= fgGetNode( "/autopilot/settings/heading-bug-deg", false );
if ( bnode ) {
double diff = bnode->getDoubleValue() - heading;

View file

@ -160,7 +160,7 @@ HeadingIndicatorFG::update (double dt)
// calculate the difference between the indicated heading
// and the selected heading for use with an autopilot
static SGPropertyNode *bnode
SGPropertyNode *bnode
= fgGetNode( "/autopilot/settings/heading-bug-deg", false );
double diff = 0;
if ( bnode ){

View file

@ -233,7 +233,7 @@ MasterReferenceGyro::update (double dt)
indicated_hdg_rate = _last_yaw_rate;
// calculate the difference between the indicated heading
// and the selected heading for use with an autopilot
static SGPropertyNode *bnode
SGPropertyNode *bnode
= fgGetNode( "/autopilot/settings/heading-bug-deg", false );
if ( bnode ) {

View file

@ -465,18 +465,17 @@ do_hires_screen_capture (const SGPropertyNode * arg)
static bool
do_tile_cache_reload (const SGPropertyNode * arg)
{
static const SGPropertyNode *master_freeze
= fgGetNode("/sim/freeze/master");
SGPropertyNode *master_freeze = fgGetNode("/sim/freeze/master");
bool freeze = master_freeze->getBoolValue();
SG_LOG(SG_INPUT, SG_INFO, "ReIniting TileCache");
if ( !freeze ) {
fgSetBool("/sim/freeze/master", true);
master_freeze->setBoolValue(true);
}
globals->get_subsystem("tile-manager")->reinit();
if ( !freeze ) {
fgSetBool("/sim/freeze/master", false);
master_freeze->setBoolValue(false);
}
return true;
}

View file

@ -793,15 +793,14 @@ void fgPostInitSubsystems()
// Reset: this is what the 'reset' command (and hence, GUI) is attached to
void fgReInitSubsystems()
{
static const SGPropertyNode *master_freeze
= fgGetNode("/sim/freeze/master");
SGPropertyNode *master_freeze = fgGetNode("/sim/freeze/master");
SG_LOG( SG_GENERAL, SG_INFO, "fgReInitSubsystems()");
// setup state to begin re-init
bool freeze = master_freeze->getBoolValue();
if ( !freeze ) {
fgSetBool("/sim/freeze/master", true);
master_freeze->setBoolValue(true);
}
fgSetBool("/sim/signals/reinit", true);
@ -846,7 +845,7 @@ void fgReInitSubsystems()
// setup state to end re-init
fgSetBool("/sim/signals/reinit", false);
if ( !freeze ) {
fgSetBool("/sim/freeze/master", false);
master_freeze->setBoolValue(false);
}
fgSetBool("/sim/sceneryloaded",false);
}

View file

@ -376,14 +376,19 @@ setWindingCCW (bool state)
glFrontFace ( GL_CW );
}
static const char *
getLongitudeString ()
////////////////////////////////////////////////////////////////////////
// Tie the properties.
////////////////////////////////////////////////////////////////////////
SGConstPropertyNode_ptr FGProperties::_longDeg;
SGConstPropertyNode_ptr FGProperties::_latDeg;
SGConstPropertyNode_ptr FGProperties::_lonLatformat;
const char *
FGProperties::getLongitudeString ()
{
static SGConstPropertyNode_ptr n = fgGetNode("/position/longitude-deg", true);
static SGConstPropertyNode_ptr f = fgGetNode("/sim/lon-lat-format", true);
static char buf[32];
double d = n->getDoubleValue();
int format = f->getIntValue();
double d = _longDeg->getDoubleValue();
int format = _lonLatformat->getIntValue();
char c = d < 0.0 ? 'W' : 'E';
if (format == 0) {
@ -411,14 +416,12 @@ getLongitudeString ()
return buf;
}
static const char *
getLatitudeString ()
const char *
FGProperties::getLatitudeString ()
{
static SGConstPropertyNode_ptr n = fgGetNode("/position/latitude-deg", true);
static SGConstPropertyNode_ptr f = fgGetNode("/sim/lon-lat-format", true);
static char buf[32];
double d = n->getDoubleValue();
int format = f->getIntValue();
double d = _latDeg->getDoubleValue();
int format = _lonLatformat->getIntValue();
char c = d < 0.0 ? 'S' : 'N';
if (format == 0) {
@ -443,9 +446,6 @@ getLatitudeString ()
////////////////////////////////////////////////////////////////////////
// Tie the properties.
////////////////////////////////////////////////////////////////////////
FGProperties::FGProperties ()
{
@ -463,6 +463,31 @@ FGProperties::init ()
void
FGProperties::bind ()
{
_longDeg = fgGetNode("/position/longitude-deg", true);
_latDeg = fgGetNode("/position/latitude-deg", true);
_lonLatformat = fgGetNode("/sim/lon-lat-format", true);
_offset = fgGetNode("/sim/time/local-offset", true);
// utc date/time
_uyear = fgGetNode("/sim/time/utc/year", true);
_umonth = fgGetNode("/sim/time/utc/month", true);
_uday = fgGetNode("/sim/time/utc/day", true);
_uhour = fgGetNode("/sim/time/utc/hour", true);
_umin = fgGetNode("/sim/time/utc/minute", true);
_usec = fgGetNode("/sim/time/utc/second", true);
_uwday = fgGetNode("/sim/time/utc/weekday", true);
_udsec = fgGetNode("/sim/time/utc/day-seconds", true);
// real local date/time
_ryear = fgGetNode("/sim/time/real/year", true);
_rmonth = fgGetNode("/sim/time/real/month", true);
_rday = fgGetNode("/sim/time/real/day", true);
_rhour = fgGetNode("/sim/time/real/hour", true);
_rmin = fgGetNode("/sim/time/real/minute", true);
_rsec = fgGetNode("/sim/time/real/second", true);
_rwday = fgGetNode("/sim/time/real/weekday", true);
_tiedProperties.setRoot(globals->get_props());
// Simulation
@ -491,54 +516,39 @@ void
FGProperties::unbind ()
{
_tiedProperties.Untie();
// drop static references to properties
_longDeg = 0;
_latDeg = 0;
_lonLatformat = 0;
}
void
FGProperties::update (double dt)
{
static SGPropertyNode_ptr offset = fgGetNode("/sim/time/local-offset", true);
offset->setIntValue(globals->get_time_params()->get_local_offset());
_offset->setIntValue(globals->get_time_params()->get_local_offset());
// utc date/time
static SGPropertyNode_ptr uyear = fgGetNode("/sim/time/utc/year", true);
static SGPropertyNode_ptr umonth = fgGetNode("/sim/time/utc/month", true);
static SGPropertyNode_ptr uday = fgGetNode("/sim/time/utc/day", true);
static SGPropertyNode_ptr uhour = fgGetNode("/sim/time/utc/hour", true);
static SGPropertyNode_ptr umin = fgGetNode("/sim/time/utc/minute", true);
static SGPropertyNode_ptr usec = fgGetNode("/sim/time/utc/second", true);
static SGPropertyNode_ptr uwday = fgGetNode("/sim/time/utc/weekday", true);
static SGPropertyNode_ptr udsec = fgGetNode("/sim/time/utc/day-seconds", true);
struct tm *u = globals->get_time_params()->getGmt();
uyear->setIntValue(u->tm_year + 1900);
umonth->setIntValue(u->tm_mon + 1);
uday->setIntValue(u->tm_mday);
uhour->setIntValue(u->tm_hour);
umin->setIntValue(u->tm_min);
usec->setIntValue(u->tm_sec);
uwday->setIntValue(u->tm_wday);
udsec->setIntValue(u->tm_hour * 3600 + u->tm_min * 60 + u->tm_sec);
_uyear->setIntValue(u->tm_year + 1900);
_umonth->setIntValue(u->tm_mon + 1);
_uday->setIntValue(u->tm_mday);
_uhour->setIntValue(u->tm_hour);
_umin->setIntValue(u->tm_min);
_usec->setIntValue(u->tm_sec);
_uwday->setIntValue(u->tm_wday);
_udsec->setIntValue(u->tm_hour * 3600 + u->tm_min * 60 + u->tm_sec);
// real local date/time
static SGPropertyNode_ptr ryear = fgGetNode("/sim/time/real/year", true);
static SGPropertyNode_ptr rmonth = fgGetNode("/sim/time/real/month", true);
static SGPropertyNode_ptr rday = fgGetNode("/sim/time/real/day", true);
static SGPropertyNode_ptr rhour = fgGetNode("/sim/time/real/hour", true);
static SGPropertyNode_ptr rmin = fgGetNode("/sim/time/real/minute", true);
static SGPropertyNode_ptr rsec = fgGetNode("/sim/time/real/second", true);
static SGPropertyNode_ptr rwday = fgGetNode("/sim/time/real/weekday", true);
time_t real = time(0);
struct tm *r = localtime(&real);
ryear->setIntValue(r->tm_year + 1900);
rmonth->setIntValue(r->tm_mon + 1);
rday->setIntValue(r->tm_mday);
rhour->setIntValue(r->tm_hour);
rmin->setIntValue(r->tm_min);
rsec->setIntValue(r->tm_sec);
rwday->setIntValue(r->tm_wday);
_ryear->setIntValue(r->tm_year + 1900);
_rmonth->setIntValue(r->tm_mon + 1);
_rday->setIntValue(r->tm_mday);
_rhour->setIntValue(r->tm_hour);
_rmin->setIntValue(r->tm_min);
_rsec->setIntValue(r->tm_sec);
_rwday->setIntValue(r->tm_wday);
}

View file

@ -30,6 +30,15 @@ public:
private:
simgear::TiedPropertyList _tiedProperties;
static const char* getLatitudeString ();
static const char* getLongitudeString ();
static SGConstPropertyNode_ptr _longDeg, _latDeg, _lonLatformat;
SGPropertyNode_ptr _offset;
SGPropertyNode_ptr _uyear, _umonth, _uday, _uhour, _umin, _usec, _uwday, _udsec;
SGPropertyNode_ptr _ryear, _rmonth, _rday, _rhour, _rmin, _rsec, _rwday, _rdsec;
};

View file

@ -75,13 +75,12 @@ using std::vector;
// is initialized.
extern int _bootstrap_OSInit;
static SGPropertyNode_ptr frame_signal;
// What should we do when we have nothing else to do? Let's get ready
// for the next move and update the display?
static void fgMainLoop( void )
{
static SGPropertyNode_ptr frame_signal
= fgGetNode("/sim/signals/frame", true);
frame_signal->fireValueChanged();
SG_LOG( SG_GENERAL, SG_DEBUG, "Running Main Loop");
@ -264,6 +263,8 @@ static void fgIdleFunction ( void ) {
// We've finished all our initialization steps, from now on we
// run the main loop.
fgSetBool("sim/sceneryloaded", false);
// stash current frame signal property
frame_signal = fgGetNode("/sim/signals/frame", true);
fgRegisterIdleHandler( fgMainLoop );
}
}

View file

@ -129,16 +129,15 @@ fgUnescape (const char *s)
// or an empty string otherwise.
const char *fgValidatePath (const char *str, bool write)
{
static SGPropertyNode_ptr r, w;
if (!r) {
r = fgGetNode("/sim/paths/validate/read", true);
r->setAttribute(SGPropertyNode::READ, true);
r->setAttribute(SGPropertyNode::WRITE, true);
SGPropertyNode_ptr r, w;
r = fgGetNode("/sim/paths/validate/read", true);
r->setAttribute(SGPropertyNode::READ, true);
r->setAttribute(SGPropertyNode::WRITE, true);
w = fgGetNode("/sim/paths/validate/write", true);
w->setAttribute(SGPropertyNode::READ, true);
w->setAttribute(SGPropertyNode::WRITE, true);
w = fgGetNode("/sim/paths/validate/write", true);
w->setAttribute(SGPropertyNode::READ, true);
w->setAttribute(SGPropertyNode::WRITE, true);
}
SGPropertyNode *prop = write ? w : r;
prop->setStringValue(str);
const char *result = prop->getStringValue();

View file

@ -20,6 +20,7 @@
//
// $Id$
// TODO FIXME Module still contains lots of "static SGPropertyNode"s below.
#ifdef HAVE_CONFIG_H
# include <config.h>

View file

@ -40,8 +40,15 @@
#include "atlas.hxx"
FGAtlas::FGAtlas() {
fdm = new FlightProperties;
FGAtlas::FGAtlas() :
length(0),
fdm(new FlightProperties)
{
_adf_freq = fgGetNode("/instrumentation/adf/frequencies/selected-khz", true);
_nav1_freq = fgGetNode("/instrumentation/nav/frequencies/selected-mhz", true);
_nav1_sel_radial = fgGetNode("/instrumentation/nav/radials/selected-deg", true);
_nav2_freq = fgGetNode("/instrumentation/nav[1]/frequencies/selected-mhz", true);
_nav2_sel_radial = fgGetNode("/instrumentation/nav[1]/radials/selected-deg", true);
}
FGAtlas::~FGAtlas() {
@ -71,18 +78,6 @@ static char calc_atlas_cksum(char *sentence) {
// generate Atlas message
bool FGAtlas::gen_message() {
// cout << "generating atlas message" << endl;
static SGPropertyNode *adf_freq
= fgGetNode("/instrumentation/adf/frequencies/selected-khz", true);
static SGPropertyNode *nav1_freq
= fgGetNode("/instrumentation/nav/frequencies/selected-mhz", true);
static SGPropertyNode *nav1_sel_radial
= fgGetNode("/instrumentation/nav/radials/selected-deg", true);
static SGPropertyNode *nav2_freq
= fgGetNode("/instrumentation/nav[1]/frequencies/selected-mhz", true);
static SGPropertyNode *nav2_sel_radial
= fgGetNode("/instrumentation/nav[1]/radials/selected-deg", true);
char rmc[256], gga[256], patla[256];
char rmc_sum[10], gga_sum[10], patla_sum[10];
char dir;
@ -146,11 +141,11 @@ bool FGAtlas::gen_message() {
sprintf( gga_sum, "%02X", calc_atlas_cksum(gga) );
sprintf( patla, "PATLA,%.2f,%.1f,%.2f,%.1f,%.0f",
nav1_freq->getDoubleValue(),
nav1_sel_radial->getDoubleValue(),
nav2_freq->getDoubleValue(),
nav2_sel_radial->getDoubleValue(),
adf_freq->getDoubleValue() );
_nav1_freq->getDoubleValue(),
_nav1_sel_radial->getDoubleValue(),
_nav2_freq->getDoubleValue(),
_nav2_sel_radial->getDoubleValue(),
_adf_freq->getDoubleValue() );
sprintf( patla_sum, "%02X", calc_atlas_cksum(patla) );
SG_LOG( SG_IO, SG_DEBUG, rmc );

View file

@ -30,6 +30,7 @@
#include <string>
#include "protocol.hxx"
#include <simgear/props/props.hxx>
class FlightProperties;
@ -38,7 +39,8 @@ class FGAtlas : public FGProtocol {
char buf[ FG_MAX_MSG_SIZE ];
int length;
FlightProperties* fdm;
SGPropertyNode_ptr _adf_freq, _nav1_freq,_nav1_sel_radial, _nav2_freq, _nav2_sel_radial;
public:
FGAtlas();

View file

@ -20,6 +20,7 @@
//
// $Id$
// TODO FIXME Module still contains lots of "static SGPropertyNode"s below.
#ifdef HAVE_CONFIG_H
# include <config.h>

View file

@ -151,6 +151,7 @@ void FGLight::bind () {
_sunAngleRad = prop->getNode("/sim/time/sun-angle-rad", true);
_sunAngleRad->setDoubleValue(_sun_angle);
_humidity = fgGetNode("/environment/relative-humidity", true);
// Read Only
tie(prop,"/rendering/scene/ambient/red", SGRawValuePointer<float>(&_scene_ambient[0]));
@ -210,8 +211,7 @@ void FGLight::update_sky_color () {
// calculate lighting parameters based on sun's relative angle to
// local up
static SGConstPropertyNode_ptr humidity = fgGetNode("/environment/relative-humidity");
float av = humidity->getFloatValue() * 45;
float av = _humidity->getFloatValue() * 45;
float visibility_log = log(av)/11.0;
float visibility_inv = (45000.0 - av)/45000.0;

View file

@ -117,6 +117,8 @@ private:
SGPropertyNode_ptr _sunAngleRad;
SGPropertyNode_ptr _humidity;
simgear::TiedPropertyList _tiedProperties;
/**

View file

@ -83,6 +83,9 @@ FGEventHandler::FGEventHandler() :
for (int i = 0; i < 128; i++)
release_keys[i] = i;
_display = fgGetNode("/sim/rendering/on-screen-statistics", true);
_print = fgGetNode("/sim/rendering/print-statistics", true);
}
namespace
@ -356,10 +359,7 @@ void FGEventHandler::handleKey(const osgGA::GUIEventAdapter& ea, int& key,
void FGEventHandler::handleStats(osgGA::GUIActionAdapter& us)
{
static SGPropertyNode_ptr display = fgGetNode("/sim/rendering/on-screen-statistics", true);
static SGPropertyNode_ptr print = fgGetNode("/sim/rendering/print-statistics", true);
int type = display->getIntValue() % osgViewer::StatsHandler::LAST;
int type = _display->getIntValue() % osgViewer::StatsHandler::LAST;
if (type != statsType) {
statsEvent->setKey(displayStatsKey);
do {
@ -371,13 +371,13 @@ void FGEventHandler::handleStats(osgGA::GUIActionAdapter& us)
}
} while (statsType != type);
display->setIntValue(statsType);
_display->setIntValue(statsType);
}
if (print->getBoolValue()) {
if (_print->getBoolValue()) {
statsEvent->setKey(printStatsKey);
statsHandler->handle(*statsEvent, us);
print->setBoolValue(false);
_print->setBoolValue(false);
}
}

View file

@ -120,6 +120,7 @@ protected:
int release_keys[128];
void handleStats(osgGA::GUIActionAdapter& us);
bool changeStatsCameraRenderOrder;
SGPropertyNode_ptr _display, _print;
};
void eventToWindowCoords(const osgGA::GUIEventAdapter* ea, double& x, double& y);

View file

@ -409,7 +409,6 @@ FGRenderer::FGRenderer() :
#ifdef FG_JPEG_SERVER
jpgRenderFrame = updateRenderer;
#endif
eventHandler = new FGEventHandler;
_numCascades = 4;
_cascadeFar[0] = 5.f;
@ -487,6 +486,8 @@ public:
void
FGRenderer::init( void )
{
eventHandler = new FGEventHandler();
sgUserDataInit( globals->get_props() );
_classicalRenderer = !fgGetBool("/sim/rendering/rembrandt/enabled", false);