Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.