fix: sky and cockpit to turn black
Metar sky condition without base layer height (e.g. FEW///) is the cause of this issue. Randomize the base layer height when the actual height is unknown.
This commit is contained in:
parent
0f482c14dd
commit
074cb31c28
@ -46,6 +46,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
#include <simgear/math/sg_random.h>
|
||||||
#include <simgear/structure/exception.hxx>
|
#include <simgear/structure/exception.hxx>
|
||||||
|
|
||||||
#include "metar.hxx"
|
#include "metar.hxx"
|
||||||
@ -1069,9 +1070,12 @@ bool SGMetar::scanSkyCondition()
|
|||||||
return false;
|
return false;
|
||||||
m += i;
|
m += i;
|
||||||
|
|
||||||
if (!strncmp(m, "///", 3)) // vis not measurable (e.g. because of heavy snowing)
|
if (!strncmp(m, "///", 3)) { // vis not measurable (e.g. because of heavy snowing)
|
||||||
m += 3, i = -1;
|
m += 3, i = -1;
|
||||||
else if (scanBoundary(&m)) {
|
sg_srandom_time();
|
||||||
|
// randomize the base height to avoid the black sky issue
|
||||||
|
i = 50 + static_cast<int>(sg_random() * 250.0); // range [5,000, 30,000]
|
||||||
|
} else if (scanBoundary(&m)) {
|
||||||
_m = m;
|
_m = m;
|
||||||
return true; // ignore single OVC/BKN/...
|
return true; // ignore single OVC/BKN/...
|
||||||
} else if (!scanNumber(&m, &i, 3))
|
} else if (!scanNumber(&m, &i, 3))
|
||||||
|
Loading…
Reference in New Issue
Block a user