From 4a8e1e498137f2a224bb33022815a52ef3c9bca9 Mon Sep 17 00:00:00 2001 From: PlayeRom Date: Mon, 15 Aug 2022 00:41:04 +0200 Subject: [PATCH] Code review --- addon-main.nas | 2 +- aerotow.nas | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addon-main.nas b/addon-main.nas index ef515a5..d4200ea 100644 --- a/addon-main.nas +++ b/addon-main.nas @@ -36,7 +36,7 @@ var main = func(addon) { loadExtraNasalFiles(addon); - setlistener("/addons/by-id/org.flightgear.addons.Aerotow/addon-devel/ai-model", func(n) { + setlistener(addon.node.getPath() ~ "/addon-devel/ai-model", func(n) { aerotow.startAerotow(); }); } diff --git a/aerotow.nas b/aerotow.nas index f44d181..c084846 100644 --- a/aerotow.nas +++ b/aerotow.nas @@ -152,7 +152,7 @@ var isScenarioAdded = func () { # Return name of selected aircraft. Possible values: "Cub", "DR400", "c182". # var getSelectedAircraft = func () { - return getprop("/addons/by-id/org.flightgear.addons.Aerotow/addon-devel/ai-model") or "Cub"; + return getprop(addon.node.getPath() ~ "/addon-devel/ai-model") or "Cub"; } # @@ -183,7 +183,7 @@ var generateFlightPlanXml = func () { if (runway.length < minRwyLength) { messages.displayError( "This runway is too short. Please choose a longer one than " ~ minRwyLength ~ " m " - ~ "(" ~ math.round(minRwyLength * M2FT) ~ " ft)." + ~ "(" ~ math.round(minRwyLength * globals.M2FT) ~ " ft)." ); return 0; } @@ -335,7 +335,7 @@ var initAircraftVariable = func (airport, runway, isGliderPos = 1) { # Set AI airplane altitude as glider altitude (assumed it's on the ground). # It is more accurate than airport.elevation. - g_altitude = gliderCoord.alt() * M2FT; + g_altitude = gliderCoord.alt() * globals.M2FT; } #