Skip to content

Commit

Permalink
Clean up AircraftInstanceModel.isOnGround() method
Browse files Browse the repository at this point in the history
  • Loading branch information
erikquinn committed Dec 19, 2016
1 parent 2e4cb1b commit d8b7239
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/assets/scripts/aircraft/AircraftInstanceModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit d8b7239

Please sign in to comment.