]> git.mxchange.org Git - flightgear.git/commitdiff
- fix two bugs
authormfranz <mfranz>
Thu, 15 Jun 2006 16:03:27 +0000 (16:03 +0000)
committermfranz <mfranz>
Thu, 15 Jun 2006 16:03:27 +0000 (16:03 +0000)
- remove yet more unused code
- cosmetics

src/Cockpit/cockpit.cxx
src/Cockpit/hud.hxx
src/Cockpit/hud_dnst.cxx
src/Cockpit/hud_inst.cxx
src/Cockpit/hud_labl.cxx
src/Cockpit/hud_ladr.cxx
src/Cockpit/hud_lat.cxx
src/Cockpit/hud_lon.cxx
src/Cockpit/hud_scal.cxx

index 5aa7f82411e98539ad3b83f9ae315a6f84857a4d..a1b034754d483ee481cbdefe4499fc0b8bfef8e8 100644 (file)
@@ -651,14 +651,14 @@ char *coord_format_lon(float longitude)
 
 void fgLatLonFormatToggle( puObject *)
 {
-    static int toggle = 0;
+    static bool toggle = false;
 
     if ( toggle )
         fgLatLonFormat = toDM;
     else
         fgLatLonFormat = toDMS;
 
-    toggle = ~toggle;
+    toggle = !toggle;
 }
 
 #ifdef NOT_USED
index 00069c9578c7b52cdedae3a2dbeaea8f5253c632..73582fe2625793690ad97ca446d1a68f64bb9063 100644 (file)
@@ -235,12 +235,10 @@ public:
     fgLineSeg2D( const fgLineSeg2D & image )
         : x0(image.x0), y0(image.y0), x1(image.x1), y1(image.y1) {}
 
-    fgLineSeg2D& operator= ( const fgLineSeg2D & image ) {
+    fgLineSeg2D& operator= ( const fgLineSeg2D & image ) { // seems unused
         x0 = image.x0; y0 = image.y0; x1 = image.x1; y1 = image.y1; return *this;
     }
 
-    ~fgLineSeg2D() {}
-
     void draw() const
     {
         glVertex2f(x0, y0);
@@ -277,12 +275,12 @@ public:
     fgText( const fgText & image )
         : x(image.x), y(image.y),digit(image.digit) { strcpy(msg,image.msg); }
 
-    fgText& operator = ( const fgText & image ) {
+    fgText& operator = ( const fgText & image ) {  // seems unused
         strcpy(msg,image.msg); x = image.x; y = image.y;digit=image.digit;
         return *this;
     }
 
-    ~fgText() { msg[0]='\0'; }
+    ~fgText() { msg[0]='\0'; }  // used but useless
 
     int getStringWidth ( char *str )
     {
@@ -364,7 +362,6 @@ class fgLineList {
     vector < fgLineSeg2D > List;
 public:
     fgLineList( void ) {}
-    ~fgLineList( void ) {}
     void add( const fgLineSeg2D& seg ) { List.push_back(seg); }
     void erase( void ) { List.erase( List.begin(), List.end() ); }
     void draw( void ) {
@@ -379,7 +376,6 @@ class fgTextList {
     vector< fgText > List;
 public:
     fgTextList ( void ) { Font = 0; }
-    ~fgTextList( void ) {}
 
     void setFont( fntRenderer *Renderer ) { Font = Renderer; }
     void add( const fgText& String ) { List.push_back(String); }
@@ -439,8 +435,6 @@ public:
                 bool           working = true,
                 int            digit = 0);
 
-    instr_item( const instr_item & image );
-
     virtual ~instr_item ();
 
     void    set_data_source ( FLTFNPTR fn ) { load_value_fn = fn; }
@@ -473,7 +467,6 @@ public:
 
     virtual void display_enable( bool working ) { is_enabled = working;}
 
-    virtual void update( void );
     virtual void break_display ( bool bad );
     virtual void SetBrightness( int illumination_level ); // fgHUDSetBright...
     void         SetPosition  ( int x, int y, UINT width, UINT height );
@@ -551,9 +544,6 @@ private:
 
 public:
     instr_label(const SGPropertyNode *);
-    ~instr_label();
-
-    instr_label(const instr_label& image);
     virtual void draw(void);
 };
 
@@ -585,8 +575,6 @@ public:
                bool         working,
                int          digits =0 );
 
-    ~lat_label();
-
     lat_label( const lat_label & image);
     virtual void draw( void );       // Required method in base class
 };
@@ -620,8 +608,6 @@ public:
                int          digit=0);
 
 
-    ~lon_label();
-
     lon_label( const lon_label & image);
     virtual void draw( void );       // Required method in base class
 };
@@ -661,15 +647,15 @@ public:
     void setArrowScale(double scale);
     // Draws arrow when runway is not visible in HUD if draw=true
     void setDrawArrow(bool draw);
-    //Always draws arrow if draw=true;
+    // Always draws arrow if draw=true;
     void setDrawArrowAlways(bool draw);
-    //Sets the maximum line scale
+    // Sets the maximum line scale
     void setLineScale(double scale);
-    //Sets the distance where to start scaling the lines
+    // Sets the distance where to start scaling the lines
     void setScaleDist(double dist_nm);
-    //Sets the stipple pattern of the outline of the runway
+    // Sets the stipple pattern of the outline of the runway
     void setStippleOutline(unsigned short stipple);
-    //Sets the stipple patter of the center line of the runway
+    // Sets the stipple patter of the center line of the runway
     void setStippleCenterline(unsigned short stipple);
 };
 
@@ -708,9 +694,6 @@ public:
                  int          dp_showing,
                  bool         working = true);
 
-    virtual ~instr_scale();
-    instr_scale( const instr_scale & image);
-
     virtual void draw    ( void ) {}; // No-op here. Defined in derived classes.
     UINT   div_min       ( void ) { return Min_div;}
     UINT   div_max       ( void ) { return Maj_div;}
@@ -787,12 +770,9 @@ public:
                       bool      working,
                       UINT      options );
 
-    virtual ~dual_instr_item() {};
-    dual_instr_item( const dual_instr_item & image);
-
-    float current_ch1( void ) { return (float)alt_data_source();}
-    float current_ch2( void ) { return (float)get_value();}
-    virtual void draw( void ) { }
+    float current_ch1( void ) { return (float)alt_data_source(); }
+    float current_ch2( void ) { return (float)get_value(); }
+    virtual void draw( void ) {}
 };
 
 
@@ -847,7 +827,6 @@ private:
 
 public:
     HudLadder(const SGPropertyNode *);
-    ~HudLadder();
 
     virtual void draw(void);
     void drawZenith(float, float, float);
index b1adb4fb3cdcc9d37ff5e1fec17e43e549954f5a..baa2d7981623c15860ade50791f63ff78d2a6210 100644 (file)
@@ -1,9 +1,6 @@
-
 #include "hud.hxx"
 
 
-//============ Top of dual_instr_item class member definitions ============
-
 dual_instr_item::dual_instr_item(
         int          x,
         int          y,
@@ -12,17 +9,11 @@ dual_instr_item::dual_instr_item(
         FLTFNPTR     chn1_source,
         FLTFNPTR     chn2_source,
         bool         working,
-        UINT         options ) :
-    instr_item( x, y, width, height,
+        UINT         options) :
+    instr_item(x, y, width, height,
                 chn1_source, options, working),
-                alt_data_source( chn2_source )
+                alt_data_source(chn2_source)
 {
 }
 
 
-dual_instr_item::dual_instr_item( const dual_instr_item & image) :
-    instr_item ((instr_item &) image ),
-    alt_data_source( image.alt_data_source)
-{
-}
-
index ec056c5e3d5b73c916a964f1fc6ff71f8162d321..8f897b5949ebff420851ac8b33fb621036c95afc 100644 (file)
@@ -57,21 +57,6 @@ instr_item::instr_item(
 }
 
 
-// copy constructor
-instr_item::instr_item( const instr_item & image ) :
-    handle       ( ++instances        ),
-    scrn_pos     ( image.scrn_pos     ),
-    load_value_fn( image.load_value_fn),
-    disp_factor  ( image.disp_factor  ),
-    opts         ( image.opts         ),
-    is_enabled   ( image.is_enabled   ),
-    broken       ( image.broken       ),
-    scr_span     ( image.scr_span     ),
-    mid_span     ( image.mid_span     )
-{
-}
-
-
 instr_item::~instr_item ()
 {
     if (instances)
@@ -79,10 +64,6 @@ instr_item::~instr_item ()
 }
 
 
-void instr_item::update( void )
-{
-}
-
 // break_display       This is emplaced to provide hooks for making
 //                     instruments unreliable. The default behavior is
 // to simply not display, but more sophisticated behavior is available
index 70145003fd62e274b7b625afd739e550df754d11..6012e58bd7ba0be7df5604475bca376983ee086a 100644 (file)
@@ -152,11 +152,6 @@ instr_label::instr_label(const SGPropertyNode *node) :
 }
 
 
-instr_label::~instr_label()
-{
-}
-
-
 void instr_label::draw(void)
 {
     char label_buffer[80];
index 8109429b81f0391853bdce76d0319e4386e918c6..0b275435f9e8419c52fbfd5234311e58f1b8d5bc 100644 (file)
@@ -62,11 +62,6 @@ HudLadder::HudLadder(const SGPropertyNode *node) :
 }
 
 
-HudLadder::~HudLadder()
-{
-}
-
-
 //
 //  Draws a climb ladder in the center of the HUD
 //
index 34da65b924fb81d8c79487009e4f1a3e4b2e2b6c..6abd3809004eb3bd44420af39609e9067011908c 100644 (file)
@@ -1,7 +1,5 @@
-
 #include "hud.hxx"
 
-
 #ifdef USE_HUD_TextList
 #define textString(x, y, text, digit)  TextString(text, x , y ,digit)
 #else
@@ -35,43 +33,15 @@ lat_label::lat_label(int           x,
 {
     if (pre_str != NULL) {
         if (post_str != NULL)
-            sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
+            sprintf(format_buffer, "%s%s%s", pre_str, pformat, post_str);
         else
-            sprintf( format_buffer, "%s%s",   pre_str, pformat );
+            sprintf(format_buffer, "%s%s", pre_str, pformat);
 
     } else if (post_str != NULL) {
-            sprintf( format_buffer, "%s%s",   pformat, post_str );
-    } // else do nothing if both pre and post strings are nulls. Interesting.
-
-}
-
-// I put this in to make it easy to construct a class member using the current
-// C code.
-
-
-lat_label::~lat_label()
-{
-}
-
-
-// Copy constructor
-lat_label::lat_label( const lat_label & image) :
-                      instr_item((const instr_item &)image),
-                      pformat    ( image.pformat  ),
-                      pre_str    ( image.pre_str  ),
-                      post_str   ( image.post_str ),
-                      blink      ( image.blink    )
-{
-    if (pre_str != NULL) {
-        if (post_str != NULL)
-            sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
-        else
-            sprintf( format_buffer, "%s%s",   pre_str, pformat );
-
-    } else if (post_str != NULL) {
-        sprintf( format_buffer, "%s%s",   pformat, post_str );
-    } // else do nothing if both pre and post strings are nulls. Interesting.
-
+        sprintf(format_buffer, "%s%s", pformat, post_str);
+    } else {
+        strcpy(format_buffer, pformat);
+    }
 }
 
 
@@ -79,28 +49,24 @@ lat_label::lat_label( const lat_label & image) :
 // draw                    Draws a label anywhere in the HUD
 //
 //
-void lat_label::draw( void )       // Required method in base class
+void lat_label::draw(void)
 {
     char label_buffer[80];
     int posincr;
     int lenstr;
-    RECT  scrn_rect = get_location();
-    // float lat = get_value();
-
-    if (data_available()) {
-//      // sprintf( label_buffer, format_buffer, coord_format_lat(lat) );
-        sprintf( label_buffer, format_buffer,
-                coord_format_lat( get_value()) );
+    RECT scrn_rect = get_location();
+    float lat = get_value();
 
-    } else {
-        sprintf( label_buffer, format_buffer );
-    }
+    if (data_available())
+        lenstr = sprintf(label_buffer, format_buffer, coord_format_lon(lat));
+    else
+        lenstr = sprintf(label_buffer, format_buffer);
 
 #ifdef DEBUGHUD
-    fgPrintf( SG_COCKPIT, SG_DEBUG, format_buffer );
-    fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
-    fgPrintf( SG_COCKPIT, SG_DEBUG, label_buffer );
-    fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
+    fgPrintf(SG_COCKPIT, SG_DEBUG, format_buffer);
+    fgPrintf(SG_COCKPIT, SG_DEBUG, "\n");
+    fgPrintf(SG_COCKPIT, SG_DEBUG, label_buffer);
+    fgPrintf(SG_COCKPIT, SG_DEBUG, "\n");
 #endif
 
     lenstr = getStringWidth(label_buffer);
@@ -108,16 +74,16 @@ void lat_label::draw( void )       // Required method in base class
     if (justify == RIGHT_JUST)
         posincr = scrn_rect.right - lenstr;
     else if (justify == CENTER_JUST)
-        posincr = get_span() - (lenstr/2);
+        posincr = get_span() - (lenstr / 2);
     else // justify == LEFT_JUST
         posincr = 0;
 
     if (fontSize == HUD_FONT_SMALL) {
-        textString( scrn_rect.left + posincr, scrn_rect.top,
+        textString(scrn_rect.left + posincr, scrn_rect.top,
                 label_buffer, get_digits());
 
     } else if (fontSize == HUD_FONT_LARGE) {
-        textString( scrn_rect.left + posincr, scrn_rect.top,
+        textString(scrn_rect.left + posincr, scrn_rect.top,
                 label_buffer, get_digits());
     }
 }
index 264806ad107d209f03a6d685a91dab6830e63551..06b675ea9fc012f59eed58b0774176af0f9aaeb8 100644 (file)
@@ -36,39 +36,15 @@ lon_label::lon_label(
 {
     if (pre_str != NULL) {
         if (post_str != NULL)
-            sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
+            sprintf(format_buffer, "%s%s%s", pre_str, pformat, post_str);
         else
-            sprintf( format_buffer, "%s%s",   pre_str, pformat );
+            sprintf(format_buffer, "%s%s", pre_str, pformat);
 
     } else if (post_str != NULL) {
-            sprintf( format_buffer, "%s%s",   pformat, post_str );
-    } // else do nothing if both pre and post strings are nulls. Interesting.
-
-}
-
-
-lon_label::~lon_label()
-{
-}
-
-
-// Copy constructor
-lon_label::lon_label( const lon_label & image) :
-    instr_item((const instr_item &)image),
-    pformat    ( image.pformat    ),
-    pre_str    ( image.pre_str  ),
-    post_str   ( image.post_str ),
-    blink      ( image.blink    )
-{
-    if (pre_str != NULL) {
-        if (post_str != NULL)
-            sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
-        else
-            sprintf( format_buffer, "%s%s",   pre_str, pformat );
-
-    } else if (post_str != NULL) {
-            sprintf( format_buffer, "%s%s",   pformat, post_str );
-    } // else do nothing if both pre and post strings are nulls. Interesting.
+        sprintf(format_buffer, "%s%s", pformat, post_str);
+    } else {
+        strcpy(format_buffer, pformat);
+    }
 }
 
 
@@ -76,25 +52,24 @@ lon_label::lon_label( const lon_label & image) :
 // draw                    Draws a label anywhere in the HUD
 //
 //
-void lon_label::draw( void )
+void lon_label::draw(void)
 {
     char label_buffer[80];
     int posincr;
     int lenstr;
-    RECT  scrn_rect = get_location();
+    RECT scrn_rect = get_location();
     float lon = get_value();
 
-    if ( data_available() ) {
-        lenstr = sprintf( label_buffer, format_buffer, coord_format_lon(lon) );
-    } else {
-        lenstr = sprintf( label_buffer, format_buffer );
-    }
+    if (data_available())
+        lenstr = sprintf(label_buffer, format_buffer, coord_format_lon(lon));
+    else
+        lenstr = sprintf(label_buffer, format_buffer);
 
 #ifdef DEBUGHUD
-    fgPrintf( SG_COCKPIT, SG_DEBUG, format_buffer );
-    fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
-    fgPrintf( SG_COCKPIT, SG_DEBUG, label_buffer );
-    fgPrintf( SG_COCKPIT, SG_DEBUG, "\n" );
+    fgPrintf(SG_COCKPIT, SG_DEBUG, format_buffer);
+    fgPrintf(SG_COCKPIT, SG_DEBUG, "\n");
+    fgPrintf(SG_COCKPIT, SG_DEBUG, label_buffer);
+    fgPrintf(SG_COCKPIT, SG_DEBUG, "\n");
 #endif
 
     lenstr = getStringWidth(label_buffer);
@@ -102,17 +77,17 @@ void lon_label::draw( void )
     if (justify == RIGHT_JUST)
         posincr = scrn_rect.right - lenstr;
     else if (justify == CENTER_JUST)
-      posincr = get_span() - (lenstr/2);
-    else //  justify == LEFT_JUST
-      posincr = 0;
+        posincr = get_span() - (lenstr / 2);
+    else // justify == LEFT_JUST
+        posincr = 0;
 
     if (fontSize == HUD_FONT_SMALL) {
-        textString( scrn_rect.left + posincr, scrn_rect.top,
-                    label_buffer, get_digits());
+        textString(scrn_rect.left + posincr, scrn_rect.top,
+                label_buffer, get_digits());
 
     } else if (fontSize == HUD_FONT_LARGE) {
-        textString( scrn_rect.left + posincr, scrn_rect.top,
-                    label_buffer, get_digits());
+        textString(scrn_rect.left + posincr, scrn_rect.top,
+                label_buffer, get_digits());
     }
 }
 
index 9ebb7a7e595e72efb5303c9fef89bc7833765c38..f2fc6abc55fb4b81e5e02de111583bf0e6af59f2 100644 (file)
@@ -51,22 +51,3 @@ instr_scale::instr_scale(
 }
 
 
-instr_scale::instr_scale( const instr_scale & image ) :
-    instr_item( (const instr_item &) image),
-    range_shown  ( image.range_shown   ),
-    Maximum_value( image.Maximum_value ),
-    Minimum_value( image.Minimum_value ),
-    scale_factor ( image.scale_factor  ),
-    Maj_div      ( image.Maj_div       ),
-    Min_div      ( image.Min_div       ),
-    Modulo       ( image.Modulo        ),
-    signif_digits( image.signif_digits )
-{
-}
-
-
-instr_scale::~instr_scale ()
-{
-}
-
-