- const char *cl[] = {"/environment/metar/clouds/layer[%i]",
- "/environment/clouds/layer[%i]"};
-
- for (j = 0; j < 2; j++)
- {
- for (i = 0, cloud = cv.begin(); cloud != cv.end(); cloud++, i++) {
- const char *coverage_string[5] =
- { "clear", "few", "scattered", "broken", "overcast" };
- const double thickness[5] = { 0, 65, 600,750, 1000};
- int q;
-
- snprintf(s, 128, cl[j], i);
- strncat(s, "/coverage", 128);
- q = cloud->getCoverage();
- fgSetString(s, coverage_string[q] );
-
- snprintf(s, 128, cl[j], i);
- strncat(s, "/elevation-ft", 128);
- fgSetDouble(s, cloud->getAltitude_ft() + station_elevation_ft);
-
- snprintf(s, 128, cl[j], i);
- strncat(s, "/thickness-ft", 128);
- fgSetDouble(s, thickness[q]);
-
- snprintf(s, 128, cl[j], i);
- strncat(s, "/span-m", 128);
- fgSetDouble(s, 40000.0);
- }
-
- for (; i < FGEnvironmentMgr::MAX_CLOUD_LAYERS; i++) {
-
-
- snprintf(s, 128, cl[j], i);
- strncat(s, "/coverage", 128);
- fgSetString(s, "clear");
-
- snprintf(s, 128, cl[j], i);
- strncat(s, "/elevation-ft", 128);
- fgSetDouble(s, -9999);
-
- snprintf(s, 128, cl[j], i);
- strncat(s, "/thickness-ft", 128);
- fgSetDouble(s, 0);
-
- snprintf(s, 128, cl[j], i);
- strncat(s, "/span-m", 128);
- fgSetDouble(s, 40000.0);
+ SGPropertyNode *metar_clouds = fgGetNode("/environment/metar/clouds", true);
+ SGPropertyNode *clouds = fgGetNode("/environment/clouds", true);
+
+ for (i = 0, cloud = cv.begin(); i < FGEnvironmentMgr::MAX_CLOUD_LAYERS; i++) {
+ const char *coverage_string[5] = { "clear", "few", "scattered", "broken", "overcast" };
+ const double thickness_value[5] = { 0, 65, 600, 750, 1000 };
+
+ const char *coverage = "clear";
+ double elevation = -9999.0;
+ double thickness = 0.0;
+ const double span = 40000.0;
+
+ if (cloud != cloud_end) {
+ int c = cloud->getCoverage();
+ coverage = coverage_string[c];
+ elevation = cloud->getAltitude_ft() + station_elevation_ft;
+ thickness = thickness_value[c];
+ ++cloud;