]> git.mxchange.org Git - simgear.git/blobdiff - simgear/metar/MetarReport.cpp
MacOS X fixes
[simgear.git] / simgear / metar / MetarReport.cpp
index 37b6a433e8fb7b50a55b5e9958ddcef5ba946629..57107b5e70aa5459a7047da6ec10ff808d0ec905 100644 (file)
@@ -7,10 +7,8 @@
 #include "MetarReport.h"
 #include "Metar.h"
 
-#if !defined (FG_HAVE_NATIVE_SGI_COMPILERS)
-FG_USING_STD(endl);
-FG_USING_STD(ostream);
-#endif
+SG_USING_STD(endl);
+SG_USING_STD(ostream);
 
 CMetarReport::CMetarReport(
    char *s ) :
@@ -40,7 +38,7 @@ static int DecodeDirChars( char* c )
                        if ( c[1] == 'E' ) r = 45;
                        else if ( c[1] == 'W' ) r = 315;
                }
-               else if ( r = 180 )
+               else if ( r == 180 )
                {
                        if ( c[1] == 'E' ) r = 135;
                        else if ( c[1] == 'W' ) r = 225;
@@ -216,17 +214,22 @@ int CMetarReport::VerticalVisibility() // Meters
 
 int CMetarReport::Ceiling()
 {
-       return FEET_TO_METER * ((Decoded_METAR *)m_DecodedReport)->Ceiling;
+       return
+           (int)(SG_FEET_TO_METER*((Decoded_METAR *)m_DecodedReport)->Ceiling);
 }
 
 int CMetarReport::EstimatedCeiling()
 {
-       return FEET_TO_METER * ((Decoded_METAR *)m_DecodedReport)->Estimated_Ceiling;
+       return
+           (int)(SG_FEET_TO_METER
+                 * ((Decoded_METAR *)m_DecodedReport)->Estimated_Ceiling);
 }
 
 int CMetarReport::VariableSkyLayerHeight()
 {
-       return FEET_TO_METER * ((Decoded_METAR *)m_DecodedReport)->VrbSkyLayerHgt;
+       return
+           (int)(SG_FEET_TO_METER
+                 * ((Decoded_METAR *)m_DecodedReport)->VrbSkyLayerHgt);
 }
 
 int CMetarReport::SnowDepthInches()
@@ -277,9 +280,9 @@ operator << ( ostream& out, CMetarReport& p )
 }
 
 
-double CMetarReport::AirPressure() 
+double CMetarReport::AirPressure()
 {
-  return ((Decoded_METAR *)m_DecodedReport)->inches_altstng;
+    return ((Decoded_METAR *)m_DecodedReport)->inches_altstng;
 }
 
 void CMetarReport::dump()
@@ -287,12 +290,13 @@ void CMetarReport::dump()
        prtDMETR( (Decoded_METAR *)m_DecodedReport );
 }
 
-double CMetarReport::PrevailVisibility() {
+double CMetarReport::PrevailVisibility()
+{
   //Values from each visibility field converted to meters.
   double smiles;
   double km;
   double meters;
-  smiles = ((Decoded_METAR*) m_DecodedReport)->prevail_vsbySM  * 621 ;
+  smiles = ((Decoded_METAR*) m_DecodedReport)->prevail_vsbySM * 1609.34;
   km =  ((Decoded_METAR*) m_DecodedReport)->prevail_vsbyKM * 1000;
   meters =  ((Decoded_METAR*) m_DecodedReport)->prevail_vsbyM;