From d8b7239a15e6408abbf62576547ba24dbe2b1560 Mon Sep 17 00:00:00 2001 From: Erik Quinn Date: Sun, 18 Dec 2016 20:45:17 -0500 Subject: [PATCH] Clean up AircraftInstanceModel.isOnGround() method --- src/assets/scripts/aircraft/AircraftInstanceModel.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/assets/scripts/aircraft/AircraftInstanceModel.js b/src/assets/scripts/aircraft/AircraftInstanceModel.js index 330a6d01..019de1e7 100644 --- a/src/assets/scripts/aircraft/AircraftInstanceModel.js +++ b/src/assets/scripts/aircraft/AircraftInstanceModel.js @@ -1731,11 +1731,10 @@ export default class Aircraft { */ isOnGround() { const error_allowance_ft = 5; - const apt = window.airportController.airport_get(); - const rwy_elev = apt.getRunway(this.rwy_dep || this.rwy_arr).elevation; - const apt_elev = apt.position.elevation; - const nearRunwayAltitude = abs(this.altitude - rwy_elev) < error_allowance_ft; - const nearAirportAltitude = abs(this.altitude - apt_elev) < error_allowance_ft; + const airport = window.airportController.airport_get(); + const runway = airport.getRunway(this.rwy_dep || this.rwy_arr); + const nearRunwayAltitude = abs(this.altitude - runway.elevation) < error_allowance_ft; + const nearAirportAltitude = abs(this.altitude - airport.position.elevation) < error_allowance_ft; return nearRunwayAltitude || nearAirportAltitude; }