From: curt Date: Mon, 2 Nov 1998 23:04:02 +0000 (+0000) Subject: HUD units now display in feet by default with meters being a command line X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f17926ec54529d5a020596224df4f84bcc8e8cf9;p=flightgear.git HUD units now display in feet by default with meters being a command line option. --- diff --git a/Cockpit/cockpit.cxx b/Cockpit/cockpit.cxx index 827202e8c..650e23ca3 100644 --- a/Cockpit/cockpit.cxx +++ b/Cockpit/cockpit.cxx @@ -185,18 +185,24 @@ double get_altitude( void ) // rough_elev = mesh_altitude(FG_Longitude * RAD_TO_ARCSEC, // FG_Latitude * RAD_TO_ARCSEC); - return( FG_Altitude * FEET_TO_METER /* -rough_elev */ ); + if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) { + return FG_Altitude; + } else { + return FG_Altitude * FEET_TO_METER; + } } double get_agl( void ) { fgFLIGHT *f; - double agl; f = current_aircraft.flight; - agl = FG_Altitude * FEET_TO_METER - scenery.cur_elev; - return( agl ); + if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) { + return FG_Altitude - scenery.cur_elev * METER_TO_FEET; + } else { + return FG_Altitude * FEET_TO_METER - scenery.cur_elev; + } } double get_sideslip( void ) @@ -242,7 +248,11 @@ double get_climb_rate( void ) f = current_aircraft.flight; - return( FG_Climb_Rate * FEET_TO_METER * 60.0 ); + if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) { + return FG_Climb_Rate * 60.0; + } else { + return FG_Climb_Rate * FEET_TO_METER * 60.0; + } } @@ -300,6 +310,10 @@ void fgCockpitUpdate( void ) { // $Log$ +// Revision 1.21 1998/11/02 23:04:02 curt +// HUD units now display in feet by default with meters being a command line +// option. +// // Revision 1.20 1998/10/25 14:08:40 curt // Turned "struct fgCONTROLS" into a class, with inlined accessor functions. // diff --git a/Main/options.cxx b/Main/options.cxx index 1cdd667a6..029525363 100644 --- a/Main/options.cxx +++ b/Main/options.cxx @@ -153,6 +153,7 @@ fgOPTIONS::fgOPTIONS() : tile_diameter(5), // HUD options + units(FG_UNITS_FEET), tris_or_culled(0), // Time options @@ -422,6 +423,10 @@ int fgOPTIONS::parse_option( const string& arg ) { wireframe = false; } else if ( arg == "--enable-wireframe" ) { wireframe = true; + } else if ( arg == "--units-feet" ) { + units = FG_UNITS_FEET; + } else if ( arg == "--units-meters" ) { + units = FG_UNITS_METERS; } else if ( arg.find( "--tile-radius=" ) != string::npos ) { tile_radius = parse_tile_radius( arg.substr(14) ); tile_diameter = tile_radius * 2 + 1; @@ -552,6 +557,8 @@ void fgOPTIONS::usage ( void ) { printf("\n"); printf("Hud Options:\n"); + printf("\t--units-feet: Hud displays units in feet\n"); + printf("\t--units-meters: Hud displays units in meters\n"); printf("\t--hud-tris: Hud displays number of triangles rendered\n"); printf("\t--hud-culled: Hud displays percentage of triangles culled\n"); @@ -566,6 +573,10 @@ fgOPTIONS::~fgOPTIONS( void ) { // $Log$ +// Revision 1.27 1998/11/02 23:04:04 curt +// HUD units now display in feet by default with meters being a command line +// option. +// // Revision 1.26 1998/10/17 01:34:24 curt // C++ ifying ... // diff --git a/Main/options.hxx b/Main/options.hxx index 1c6620894..13840cbd9 100644 --- a/Main/options.hxx +++ b/Main/options.hxx @@ -59,6 +59,12 @@ public: FG_OPTIONS_ERROR = 2 }; + enum + { + FG_UNITS_FEET = 0, + FG_UNITS_METERS = 1 + }; + enum fgFogKind { FG_FOG_DISABLED = 0, @@ -116,6 +122,7 @@ private: // further away. // HUD options + int units; // feet or meters int tris_or_culled; // Time options @@ -167,6 +174,7 @@ public: inline int get_tile_radius() const { return tile_radius; } inline int get_tile_diameter() const { return tile_diameter; } inline int get_time_offset() const { return time_offset; } + inline int get_units() const { return units; } inline int get_tris_or_culled() const { return tris_or_culled; } // Update functions @@ -203,6 +211,10 @@ extern fgOPTIONS current_options; // $Log$ +// Revision 1.20 1998/11/02 23:04:05 curt +// HUD units now display in feet by default with meters being a command line +// option. +// // Revision 1.19 1998/10/25 14:08:49 curt // Turned "struct fgCONTROLS" into a class, with inlined accessor functions. //