From 88a78dd3147c19be16408a81b829b0e52d81005c Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 27 May 2019 11:42:53 +0100 Subject: [PATCH] Remove last hard-coded default airport ID Neither Torsten nor I can recall why we continued to hard-code this, so make it dynamic for now. When we remember why we hard-code it, we can add a BigComment from future-James to future-future-James about why not to do this again :) --- src/Main/positioninit.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Main/positioninit.cxx b/src/Main/positioninit.cxx index 6bf4e086f..6389858de 100644 --- a/src/Main/positioninit.cxx +++ b/src/Main/positioninit.cxx @@ -663,9 +663,8 @@ bool initPosition() } if ( !set_pos ) { - // No lon/lat specified, no airport specified, use the default airport - // TODO: don't hardcode this. Really. - const FGAirport* airport = fgFindAirportID("PHNL"); + const std::string defaultAirportId = fgGetString("/sim/presets/airport-id"); + const FGAirport* airport = fgFindAirportID(defaultAirportId); if( airport ) { const SGGeod & airportGeod = airport->geod(); fgSetDouble("/sim/presets/longitude-deg", airportGeod.getLongitudeDeg()); @@ -675,7 +674,8 @@ bool initPosition() // Let's hope KSFO still exists somehow fgSetDouble("/sim/presets/longitude-deg", -122.374843); fgSetDouble("/sim/presets/latitude-deg", 37.619002); - SG_LOG(SG_GENERAL, SG_ALERT, "Sorry, the default airport seems to be unknown."); + SG_LOG(SG_GENERAL, SG_ALERT, "Sorry, the default airport ('" << defaultAirportId + << "') seems to be unknown."); } }