1
0
Fork 0

Oops, in the latest property manager rewrite, a typo crept in on

somewhat of a global scale.  This commit should fix all these up.
This commit is contained in:
curt 2002-03-26 02:38:11 +00:00
parent e82d7d5a64
commit 0a035c7f36
12 changed files with 42 additions and 30 deletions

View file

@ -315,7 +315,7 @@ void NewAltitudeInit()
float alt = cur_fdm_state->get_Altitude(); float alt = cur_fdm_state->get_Altitude();
if ( !strcmp("/sim/startup/units", "meters")) { if ( !strcmp(fgGetString("/sim/startup/units"), "meters")) {
alt *= SG_FEET_TO_METER; alt *= SG_FEET_TO_METER;
} }
@ -614,7 +614,7 @@ void TgtAptDialog_OK (puObject *)
TgtAptId = tmp.substr( 0, pos ); TgtAptId = tmp.substr( 0, pos );
string alt_str = tmp.substr( pos + 1 ); string alt_str = tmp.substr( pos + 1 );
alt = atof( alt_str.c_str() ); alt = atof( alt_str.c_str() );
if ( !strcmp("/sim/startup/units", "feet") ) { if ( !strcmp(fgGetString("/sim/startup/units"), "feet") ) {
alt *= SG_FEET_TO_METER; alt *= SG_FEET_TO_METER;
} }
} else { } else {

View file

@ -907,7 +907,7 @@ void FGAutopilot::set_AltitudeMode( fgAutoAltitudeMode mode ) {
* SG_FEET_TO_METER ) { * SG_FEET_TO_METER ) {
} }
if ( !strcmp("/sim/startup/units", "feet") ) { if ( !strcmp(fgGetString("/sim/startup/units"), "feet") ) {
MakeTargetAltitudeStr( TargetAltitude * SG_METER_TO_FEET ); MakeTargetAltitudeStr( TargetAltitude * SG_METER_TO_FEET );
} else { } else {
MakeTargetAltitudeStr( TargetAltitude * SG_METER_TO_FEET ); MakeTargetAltitudeStr( TargetAltitude * SG_METER_TO_FEET );
@ -918,7 +918,7 @@ void FGAutopilot::set_AltitudeMode( fgAutoAltitudeMode mode ) {
} else if ( altitude_mode == FG_ALTITUDE_TERRAIN ) { } else if ( altitude_mode == FG_ALTITUDE_TERRAIN ) {
TargetAGL = altitude_agl_node->getDoubleValue() * SG_FEET_TO_METER; TargetAGL = altitude_agl_node->getDoubleValue() * SG_FEET_TO_METER;
if ( !strcmp("/sim/startup/units", "feet") ) { if ( !strcmp(fgGetString("/sim/startup/units"), "feet") ) {
MakeTargetAltitudeStr( TargetAGL * SG_METER_TO_FEET ); MakeTargetAltitudeStr( TargetAGL * SG_METER_TO_FEET );
} else { } else {
MakeTargetAltitudeStr( TargetAGL * SG_METER_TO_FEET ); MakeTargetAltitudeStr( TargetAGL * SG_METER_TO_FEET );
@ -933,7 +933,7 @@ void FGAutopilot::set_AltitudeMode( fgAutoAltitudeMode mode ) {
void FGAutopilot::AltitudeSet( double new_altitude ) { void FGAutopilot::AltitudeSet( double new_altitude ) {
double target_alt = new_altitude; double target_alt = new_altitude;
if ( !strcmp("/sim/startup/units", "feet") ) { if ( !strcmp(fgGetString("/sim/startup/units"), "feet") ) {
target_alt = new_altitude * SG_FEET_TO_METER; target_alt = new_altitude * SG_FEET_TO_METER;
} }
@ -944,7 +944,7 @@ void FGAutopilot::AltitudeSet( double new_altitude ) {
TargetAltitude = target_alt; TargetAltitude = target_alt;
altitude_mode = FG_ALTITUDE_LOCK; altitude_mode = FG_ALTITUDE_LOCK;
if ( !strcmp("/sim/startup/units", "feet") ) { if ( !strcmp(fgGetString("/sim/startup/units"), "feet") ) {
target_alt *= SG_METER_TO_FEET; target_alt *= SG_METER_TO_FEET;
} }
// ApAltitudeDialogInput->setValue((float)target_alt); // ApAltitudeDialogInput->setValue((float)target_alt);
@ -958,7 +958,7 @@ void FGAutopilot::AltitudeAdjust( double inc )
{ {
double target_alt, target_agl; double target_alt, target_agl;
if ( !strcmp("/sim/startup/units", "feet") ) { if ( !strcmp(fgGetString("/sim/startup/units"), "feet") ) {
target_alt = TargetAltitude * SG_METER_TO_FEET; target_alt = TargetAltitude * SG_METER_TO_FEET;
target_agl = TargetAGL * SG_METER_TO_FEET; target_agl = TargetAGL * SG_METER_TO_FEET;
} else { } else {
@ -978,7 +978,7 @@ void FGAutopilot::AltitudeAdjust( double inc )
target_agl = ( int ) ( target_agl / inc ) * inc + inc; target_agl = ( int ) ( target_agl / inc ) * inc + inc;
} }
if ( !strcmp("/sim/startup/units", "feet") ) { if ( !strcmp(fgGetString("/sim/startup/units"), "feet") ) {
target_alt *= SG_FEET_TO_METER; target_alt *= SG_FEET_TO_METER;
target_agl *= SG_FEET_TO_METER; target_agl *= SG_FEET_TO_METER;
} }
@ -986,9 +986,9 @@ void FGAutopilot::AltitudeAdjust( double inc )
TargetAltitude = target_alt; TargetAltitude = target_alt;
TargetAGL = target_agl; TargetAGL = target_agl;
if ( !strcmp("/sim/startup/units", "feet") ) if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
target_alt *= SG_METER_TO_FEET; target_alt *= SG_METER_TO_FEET;
if ( !strcmp("/sim/startup/units", "feet") ) if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
target_agl *= SG_METER_TO_FEET; target_agl *= SG_METER_TO_FEET;
if ( altitude_mode == FG_ALTITUDE_LOCK ) { if ( altitude_mode == FG_ALTITUDE_LOCK ) {

View file

@ -195,9 +195,12 @@ float get_altitude( void )
float get_agl( void ) float get_agl( void )
{ {
static const SGPropertyNode *startup_units_node
= fgGetNode("/sim/startup/units");
float agl; float agl;
if ( !strcmp("/sim/startup/units", "feet") ) { if ( !strcmp(startup_units_node->getStringValue(), "feet") ) {
agl = (current_aircraft.fdm_state->get_Altitude() agl = (current_aircraft.fdm_state->get_Altitude()
- scenery.get_cur_elev() * SG_METER_TO_FEET); - scenery.get_cur_elev() * SG_METER_TO_FEET);
} else { } else {
@ -246,8 +249,11 @@ float get_vfc_tris_culled ( void )
float get_climb_rate( void ) float get_climb_rate( void )
{ {
static const SGPropertyNode *startup_units_node
= fgGetNode("/sim/startup/units");
float climb_rate; float climb_rate;
if ( !strcmp("/sim/startup/units", "feet") ) { if ( !strcmp(startup_units_node->getStringValue(), "feet") ) {
climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * 60.0; climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * 60.0;
} else { } else {
climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * SG_FEET_TO_METER * 60.0; climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * SG_FEET_TO_METER * 60.0;

View file

@ -646,10 +646,12 @@ readTBI(const SGPropertyNode * node)
int readInstrument(const SGPropertyNode * node) int readInstrument(const SGPropertyNode * node)
{ {
static const SGPropertyNode *startup_units_node
= fgGetNode("/sim/startup/units");
instr_item *HIptr; instr_item *HIptr;
if ( !strcmp("/sim/startup/units", "feet") ) { if ( !strcmp(startup_units_node->getStringValue(), "feet") ) {
strcpy(units, " ft"); strcpy(units, " ft");
} else { } else {
strcpy(units, " m"); strcpy(units, " m");

View file

@ -239,7 +239,9 @@ void FGExternalNet::init() {
sprintf( cmd, "/longitude-deg?value=%.8f", lon ); sprintf( cmd, "/longitude-deg?value=%.8f", lon );
new HTTPClient( fdm_host.c_str(), cmd_port, cmd ); new HTTPClient( fdm_host.c_str(), cmd_port, cmd );
cout << "before loop()" << endl;
netChannel::loop(0); netChannel::loop(0);
cout << "here" << endl;
sprintf( cmd, "/latitude-deg?value=%.8f", lat ); sprintf( cmd, "/latitude-deg?value=%.8f", lat );
new HTTPClient( fdm_host.c_str(), cmd_port, cmd ); new HTTPClient( fdm_host.c_str(), cmd_port, cmd );

View file

@ -50,7 +50,9 @@ public:
while (*s) while (*s)
fputc(*s++,stdout); fputc(*s++,stdout);
printf("done\n");
buffer.remove(); buffer.remove();
printf("after buffer.remove()\n");
} }
}; };

View file

@ -1060,7 +1060,7 @@ void guiInit()
// Set up menu bar toggle // Set up menu bar toggle
gui_menu_on = ~0; gui_menu_on = ~0;
if (!strcmp("/sim/flight-model", "ada")) { if (!strcmp(fgGetString("/sim/flight-model"), "ada")) {
guiToggleMenu(); // Menu off by default guiToggleMenu(); // Menu off by default
} }
} }

View file

@ -309,7 +309,7 @@ do_view_cycle (const SGPropertyNode * arg, SGCommandState ** state)
{ {
globals->get_current_view()->setHeadingOffset_deg(0.0); globals->get_current_view()->setHeadingOffset_deg(0.0);
globals->get_viewmgr()->next_view(); globals->get_viewmgr()->next_view();
if ( !strcmp("/sim/flight-model", "ada") ) { if ( !strcmp(fgGetString("/sim/flight-model"), "ada") ) {
globals->get_props()->setBoolValue( "/sim/hud/visibility", true ); globals->get_props()->setBoolValue( "/sim/hud/visibility", true );
if ( globals->get_viewmgr()->get_current() == 1 ) { if ( globals->get_viewmgr()->get_current() == 1 ) {
globals->get_props()->setBoolValue( "/sim/hud/visibility", false ); globals->get_props()->setBoolValue( "/sim/hud/visibility", false );

View file

@ -792,7 +792,7 @@ bool fgInitSubsystems( void ) {
FGLocalWeatherDatabase::DatabaseWorkingType working_type; FGLocalWeatherDatabase::DatabaseWorkingType working_type;
if (!strcmp("/environment/weather/working-type", "internet")) if (!strcmp(fgGetString("/environment/weather/working-type"), "internet"))
{ {
working_type = FGLocalWeatherDatabase::use_internet; working_type = FGLocalWeatherDatabase::use_internet;
} else { } else {

View file

@ -292,11 +292,11 @@ void fgInitVisuals( void ) {
// glFogi (GL_FOG_MODE, GL_LINEAR); // glFogi (GL_FOG_MODE, GL_LINEAR);
glFogi (GL_FOG_MODE, GL_EXP2); glFogi (GL_FOG_MODE, GL_EXP2);
if ( (!strcmp("/sim/rendering/fog", "disabled")) || if ( (!strcmp(fgGetString("/sim/rendering/fog"), "disabled")) ||
(!fgGetBool("/sim/rendering/shading"))) { (!fgGetBool("/sim/rendering/shading"))) {
// if fastest fog requested, or if flat shading force fastest // if fastest fog requested, or if flat shading force fastest
glHint ( GL_FOG_HINT, GL_FASTEST ); glHint ( GL_FOG_HINT, GL_FASTEST );
} else if ( !strcmp("/sim/rendering/fog", "nicest") ) { } else if ( !strcmp(fgGetString("/sim/rendering/fog"), "nicest") ) {
glHint ( GL_FOG_HINT, GL_NICEST ); glHint ( GL_FOG_HINT, GL_NICEST );
} }
if ( fgGetBool("/sim/rendering/wireframe") ) { if ( fgGetBool("/sim/rendering/wireframe") ) {
@ -802,7 +802,7 @@ void fgUpdateTimeDepCalcs() {
FGSteam::update( multi_loop * fgGetInt("/sim/speed-up") ); FGSteam::update( multi_loop * fgGetInt("/sim/speed-up") );
} }
if ( !strcmp("/sim/view-mode", "pilot") ) { if ( !strcmp(fgGetString("/sim/view-mode"), "pilot") ) {
cur_view_fdm = *cur_fdm_state; cur_view_fdm = *cur_fdm_state;
// do nothing // do nothing
} }
@ -1758,7 +1758,7 @@ void fgUpdateDCS (void) {
// Deck should be the first object in objects.txt in case of fdm=ada // Deck should be the first object in objects.txt in case of fdm=ada
if (!strcmp("/sim/flight-model", "ada")) { if (!strcmp(fgGetString("/sim/flight-model"), "ada")) {
if ((fdm->get_iaux(1))==1) if ((fdm->get_iaux(1))==1)
{ {
obj_lat[1] = fdm->get_daux(1)*SGD_DEGREES_TO_RADIANS; obj_lat[1] = fdm->get_daux(1)*SGD_DEGREES_TO_RADIANS;

View file

@ -482,7 +482,7 @@ parse_wp( const string& arg ) {
alt_str = arg.substr( pos + 1 ); alt_str = arg.substr( pos + 1 );
// cout << "id str = " << id << " alt str = " << alt_str << endl; // cout << "id str = " << id << " alt str = " << alt_str << endl;
alt = atof( alt_str.c_str() ); alt = atof( alt_str.c_str() );
if ( !strcmp("/sim/startup/units", "feet") ) { if ( !strcmp(fgGetString("/sim/startup/units"), "feet") ) {
alt *= SG_FEET_TO_METER; alt *= SG_FEET_TO_METER;
} }
} else { } else {
@ -610,49 +610,49 @@ parse_option (const string& arg)
fgSetString("/sim/startup/airport-id", ""); fgSetString("/sim/startup/airport-id", "");
} else if ( arg.find( "--altitude=" ) == 0 ) { } else if ( arg.find( "--altitude=" ) == 0 ) {
fgSetBool("/sim/startup/onground", false); fgSetBool("/sim/startup/onground", false);
if ( !strcmp("/sim/startup/units", "feet") ) if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
fgSetDouble("/position/altitude-ft", atof(arg.substr(11))); fgSetDouble("/position/altitude-ft", atof(arg.substr(11)));
else else
fgSetDouble("/position/altitude-ft", fgSetDouble("/position/altitude-ft",
atof(arg.substr(11)) * SG_METER_TO_FEET); atof(arg.substr(11)) * SG_METER_TO_FEET);
} else if ( arg.find( "--uBody=" ) == 0 ) { } else if ( arg.find( "--uBody=" ) == 0 ) {
fgSetString("/sim/startup/speed-set", "UVW"); fgSetString("/sim/startup/speed-set", "UVW");
if ( !strcmp("/sim/startup/units", "feet") ) if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
fgSetDouble("/velocities/uBody-fps", atof(arg.substr(8))); fgSetDouble("/velocities/uBody-fps", atof(arg.substr(8)));
else else
fgSetDouble("/velocities/uBody-fps", fgSetDouble("/velocities/uBody-fps",
atof(arg.substr(8)) * SG_METER_TO_FEET); atof(arg.substr(8)) * SG_METER_TO_FEET);
} else if ( arg.find( "--vBody=" ) == 0 ) { } else if ( arg.find( "--vBody=" ) == 0 ) {
fgSetString("/sim/startup/speed-set", "UVW"); fgSetString("/sim/startup/speed-set", "UVW");
if ( !strcmp("/sim/startup/units", "feet") ) if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
fgSetDouble("/velocities/vBody-fps", atof(arg.substr(8))); fgSetDouble("/velocities/vBody-fps", atof(arg.substr(8)));
else else
fgSetDouble("/velocities/vBody-fps", fgSetDouble("/velocities/vBody-fps",
atof(arg.substr(8)) * SG_METER_TO_FEET); atof(arg.substr(8)) * SG_METER_TO_FEET);
} else if ( arg.find( "--wBody=" ) == 0 ) { } else if ( arg.find( "--wBody=" ) == 0 ) {
fgSetString("/sim/startup/speed-set", "UVW"); fgSetString("/sim/startup/speed-set", "UVW");
if ( !strcmp("/sim/startup/units", "feet") ) if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
fgSetDouble("/velocities/wBody-fps", atof(arg.substr(8))); fgSetDouble("/velocities/wBody-fps", atof(arg.substr(8)));
else else
fgSetDouble("/velocities/wBody-fps", fgSetDouble("/velocities/wBody-fps",
atof(arg.substr(8)) * SG_METER_TO_FEET); atof(arg.substr(8)) * SG_METER_TO_FEET);
} else if ( arg.find( "--vNorth=" ) == 0 ) { } else if ( arg.find( "--vNorth=" ) == 0 ) {
fgSetString("/sim/startup/speed-set", "NED"); fgSetString("/sim/startup/speed-set", "NED");
if ( !strcmp("/sim/startup/units", "feet") ) if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
fgSetDouble("/velocities/speed-north-fps", atof(arg.substr(9))); fgSetDouble("/velocities/speed-north-fps", atof(arg.substr(9)));
else else
fgSetDouble("/velocities/speed-north-fps", fgSetDouble("/velocities/speed-north-fps",
atof(arg.substr(9)) * SG_METER_TO_FEET); atof(arg.substr(9)) * SG_METER_TO_FEET);
} else if ( arg.find( "--vEast=" ) == 0 ) { } else if ( arg.find( "--vEast=" ) == 0 ) {
fgSetString("/sim/startup/speed-set", "NED"); fgSetString("/sim/startup/speed-set", "NED");
if ( !strcmp("/sim/startup/units", "feet") ) if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
fgSetDouble("/velocities/speed-east-fps", atof(arg.substr(8))); fgSetDouble("/velocities/speed-east-fps", atof(arg.substr(8)));
else else
fgSetDouble("/velocities/speed-east-fps", fgSetDouble("/velocities/speed-east-fps",
atof(arg.substr(8)) * SG_METER_TO_FEET); atof(arg.substr(8)) * SG_METER_TO_FEET);
} else if ( arg.find( "--vDown=" ) == 0 ) { } else if ( arg.find( "--vDown=" ) == 0 ) {
fgSetString("/sim/startup/speed-set", "NED"); fgSetString("/sim/startup/speed-set", "NED");
if ( !strcmp("/sim/startup/units", "feet") ) if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
fgSetDouble("/velocities/speed-down-fps", atof(arg.substr(8))); fgSetDouble("/velocities/speed-down-fps", atof(arg.substr(8)));
else else
fgSetDouble("/velocities/speed-down-fps", fgSetDouble("/velocities/speed-down-fps",
@ -708,7 +708,7 @@ parse_option (const string& arg)
fgSetBool("/environment/clouds/status", true); fgSetBool("/environment/clouds/status", true);
} else if ( arg.find( "--clouds-asl=" ) == 0 ) { } else if ( arg.find( "--clouds-asl=" ) == 0 ) {
// FIXME: check units // FIXME: check units
if ( !strcmp("/sim/startup/units", "feet") ) if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
fgSetDouble("/environment/clouds/altitude-ft", fgSetDouble("/environment/clouds/altitude-ft",
atof(arg.substr(13))); atof(arg.substr(13)));
else else

View file

@ -132,7 +132,7 @@ FGViewMgr::update (int dt)
fgGetDouble("/orientation/roll-deg"), fgGetDouble("/orientation/roll-deg"),
fgGetDouble("/orientation/pitch-deg"), fgGetDouble("/orientation/pitch-deg"),
fgGetDouble("/orientation/heading-deg")); fgGetDouble("/orientation/heading-deg"));
if (!strcmp("/sim/flight-model", "ada")) { if (!strcmp(fgGetString("/sim/flight-model"), "ada")) {
//+ve x is aft, +ve z is up (see viewer.hxx) //+ve x is aft, +ve z is up (see viewer.hxx)
pilot_view->setPositionOffsets( -5.0, 0.0, 1.0 ); pilot_view->setPositionOffsets( -5.0, 0.0, 1.0 );
} }