From 4df6cb0558c21ab52c1ad180c57dd7dad2611971 Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 9 Jan 2019 00:04:03 +0000 Subject: [PATCH] Nasal: expose additional members on fixes/navaids MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a ‘colocated_dme’ member to identify VOR/ILS pairings with DME. Also exposed the navaid unique ID for easy disambiguation. --- src/Scripting/NasalPositioned.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Scripting/NasalPositioned.cxx b/src/Scripting/NasalPositioned.cxx index ef4a94b96..3177289b2 100644 --- a/src/Scripting/NasalPositioned.cxx +++ b/src/Scripting/NasalPositioned.cxx @@ -1075,6 +1075,13 @@ static const char* navaidGhostGetMember(naContext c, void* g, naRef field, naRef } else { *out = naNil(); } + } else if (!strcmp(fieldName, "colocated_dme")) { + FGNavRecordRef dme = FGPositioned::loadById(nav->colocatedDME()); + if (dme) { + *out = ghostForNavaid(c, dme); + } else { + *out = naNil(); + } } else if (!strcmp(fieldName, "dme")) { *out = naNum(nav->hasDME()); } else if (!strcmp(fieldName, "vortac")) { @@ -1087,6 +1094,8 @@ static const char* navaidGhostGetMember(naContext c, void* g, naRef field, naRef } else { *out = naNil(); } + } else if (!strcmp(fieldName, "guid")) { + *out = naNum(nav->guid()); } else { return 0; } @@ -1102,6 +1111,9 @@ static const char* fixGhostGetMember(naContext c, void* g, naRef field, naRef* o if (!strcmp(fieldName, "id")) *out = stringToNasal(c, fix->ident()); else if (!strcmp(fieldName, "lat")) *out = naNum(fix->get_lat()); else if (!strcmp(fieldName, "lon")) *out = naNum(fix->get_lon()); + // for homogenity with other values returned by navinfo() + else if (!strcmp(fieldName, "type")) *out = stringToNasal(c, "fix"); + else if (!strcmp(fieldName, "name")) *out = stringToNasal(c, fix->ident()); else { return 0; }