Created
June 26, 2018 14:50
-
-
Save tdammers/7ea53787004ef1b87fa70155644a1ad4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit ca377c4ef297f0d6ed21f2a93a2bcbee3f2c12ca | |
Author: Tobias Dammers | |
Date: Thu Jun 21 18:29:49 2018 +0200 | |
Expose holding point data in nasal | |
diff --git a/src/Scripting/NasalPositioned.cxx b/src/Scripting/NasalPositioned.cxx | |
index 22953bb2b..0d5fda303 100644 | |
--- a/src/Scripting/NasalPositioned.cxx | |
+++ b/src/Scripting/NasalPositioned.cxx | |
@@ -494,6 +494,42 @@ static const char* waypointCommonGetMember(naContext c, Waypt* wpt, const char* | |
*out = waypointAirport(c, wpt); | |
} else if (!strcmp(fieldName, "runway")) { | |
*out = waypointRunway(c, wpt); | |
+ } else if (!strcmp(fieldName, "hld_is_left_handed")) { | |
+ Hold* hold = dynamic_cast(wpt); | |
+ if (hold) | |
+ *out = naNum(hold->isLeftHanded()); | |
+ else | |
+ return nullptr; | |
+ } else if (!strcmp(fieldName, "hld_is_distance")) { | |
+ Hold* hold = dynamic_cast(wpt); | |
+ if (hold) | |
+ *out = naNum(hold->isLeftHanded()); | |
+ else | |
+ return nullptr; | |
+ } else if (!strcmp(fieldName, "hld_by")) { | |
+ Hold* hold = dynamic_cast(wpt); | |
+ if (hold) | |
+ *out = stringToNasal(c, hold->isDistance() ? "dist" : "time"); | |
+ else | |
+ return nullptr; | |
+ } else if (!strcmp(fieldName, "hld_inbound_radial")) { | |
+ Hold* hold = dynamic_cast(wpt); | |
+ if (hold) | |
+ *out = naNum(hold->inboundRadial()); | |
+ else | |
+ return nullptr; | |
+ } else if (!strcmp(fieldName, "hld_heading_radial_deg")) { | |
+ Hold* hold = dynamic_cast(wpt); | |
+ if (hold) | |
+ *out = naNum(hold->inboundRadial()); | |
+ else | |
+ return nullptr; | |
+ } else if (!strcmp(fieldName, "hld_time_or_distance")) { | |
+ Hold* hold = dynamic_cast(wpt); | |
+ if (hold) | |
+ *out = naNum(hold->timeOrDistance()); | |
+ else | |
+ return nullptr; | |
} else { | |
return nullptr; // member not found | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment