]> git.mxchange.org Git - flightgear.git/commitdiff
HUD units now display in feet by default with meters being a command line
authorcurt <curt>
Mon, 2 Nov 1998 23:04:02 +0000 (23:04 +0000)
committercurt <curt>
Mon, 2 Nov 1998 23:04:02 +0000 (23:04 +0000)
option.

Cockpit/cockpit.cxx
Main/options.cxx
Main/options.hxx

index 827202e8cd359ff29535a243db5289fa65200670..650e23ca3a66eafefa6e6b7e0abfd3dd49ae8e3e 100644 (file)
@@ -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.
 //
index 1cdd667a684f86e53cf3602e577c08343d92c671..02952536366499d07fa009254010aaffdeb43c57 100644 (file)
@@ -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 ...
 //
index 1c6620894203c42092554cd4bc509cb39bb4e9eb..13840cbd9023d4db06d9704ca7c81abf0ee08c70 100644 (file)
@@ -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.
 //