Regarding the Runway selection bug:
The logic here is a bit convoluted, but I also had a dumb bug in normaliseBearing - I was clamping to the wrong range (0..360 instead of -180..180). This caused the scoring code to pick weird runways. I've added some extra cases to my local tests, and here's a fix.
static double normaliseBearing(double aBearing)
{
- while (aBearing < 0.0) {
+ while (aBearing < -180) {
aBearing += 360.0;
}
- while (aBearing > 360.0) {
+ while (aBearing > 180.0) {
aBearing -= 360.0;
}