]> git.mxchange.org Git - flightgear.git/blobdiff - src/Environment/fgmetar.cxx
cmake changes for osg::CullSettings::ClearMask and Fedora
[flightgear.git] / src / Environment / fgmetar.cxx
index acb5d57450c0e3883f25c3c795c0179d7f5cb79e..c9d046ca9883b566dab88bf66f9c72bdfbf8c91d 100644 (file)
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
@@ -32,6 +32,9 @@
  * TODO
  * - NSC & mil. color codes
  */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <simgear/math/sg_random.h>
 #include <simgear/timing/sg_time.hxx>
@@ -58,7 +61,7 @@ FGMetar::FGMetar(const string& icao, const string& proxy, const string& port, co
                vector<SGMetarCloud> cv = _clouds;;
                if (!cv.size()) {
                        SGMetarCloud cl;
-                       cl.set(5500 * SG_FEET_TO_METER, 2);
+                       cl.set(5500 * SG_FEET_TO_METER, SGMetarCloud::COVERAGE_SCATTERED);
                        _clouds.push_back(cl);
                }
        }
@@ -96,17 +99,19 @@ FGMetar::FGMetar(const string& icao, const string& proxy, const string& port, co
                _wind_range_from = _wind_range_to = _wind_dir;
        }
 
+       if (_wind_speed == SGMetarNaN)
+               _wind_speed = 0.0;
        if (_gust_speed == SGMetarNaN)
                _gust_speed = 0.0;
 
        // clouds
        vector<SGMetarCloud> cv = _clouds;
-       vector<SGMetarCloud>::iterator cloud;
+       vector<SGMetarCloud>::iterator cloud, cv_end = cv.end();
 
-       for (i = 0, cloud = cv.begin(); cloud != cv.end(); cloud++, i++) {
-               int cov = cloud->getCoverage();
-               if (cov == -1)
-                       cov = 0;
+       for (i = 0, cloud = cv.begin(); cloud != cv_end; ++cloud, i++) {
+               SGMetarCloud::Coverage cov = cloud->getCoverage();
+               if (cov == SGMetarCloud::COVERAGE_NIL)
+                       cov = SGMetarCloud::COVERAGE_CLEAR;
 
                double alt = cloud->getAltitude_ft();
                if (alt == SGMetarNaN)
@@ -128,8 +133,8 @@ FGMetar::FGMetar(const string& icao, const string& proxy, const string& port, co
 
        // snow cover
        map<string, SGMetarRunway> rm = getRunways();
-       map<string, SGMetarRunway>::const_iterator runway;
-       for (runway = rm.begin(); runway != rm.end(); runway++) {
+       map<string, SGMetarRunway>::const_iterator runway, rm_end = rm.end();
+       for (runway = rm.begin(); runway != rm_end; ++runway) {
                SGMetarRunway rwy = runway->second;
                if (rwy.getDeposit() >= 3 ) {
                        _snow_cover = true;