From: mfranz Date: Wed, 5 Dec 2007 10:57:51 +0000 (+0000) Subject: add runway number as "id" to the runway hash within an airport hash X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=98afaf445056336a58b3ceb61211734b818bc7d5;p=flightgear.git add runway number as "id" to the runway hash within an airport hash (It's already available as runway hash key, but the runway hash shouldn't depend on it and be self-contained.) --- diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index ca9700863..edc98a179 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -544,8 +544,13 @@ static naRef f_airportinfo(naContext c, naRef me, int argc, naRef* args) if(rwy._id != id) break; if(rwy._type[0] != 'r') continue; + naRef rwyid = naStr_fromdata(naNewString(c), + const_cast(rwy._rwy_no.c_str()), + rwy._rwy_no.length()); + naRef rwydata = naNewHash(c); #define HASHSET(s,l,n) naHash_set(rwydata, naStr_fromdata(naNewString(c),s,l),n) + HASHSET("id", 2, rwyid); HASHSET("lat", 3, naNum(rwy._lat)); HASHSET("lon", 3, naNum(rwy._lon)); HASHSET("heading", 7, naNum(rwy._heading)); @@ -556,11 +561,7 @@ static naRef f_airportinfo(naContext c, naRef me, int argc, naRef* args) HASHSET("stopway1", 8, naNum(rwy._stopway1 * SG_FEET_TO_METER)); HASHSET("stopway2", 8, naNum(rwy._stopway2 * SG_FEET_TO_METER)); #undef HASHSET - - naRef no = naStr_fromdata(naNewString(c), - const_cast(rwy._rwy_no.c_str()), - rwy._rwy_no.length()); - naHash_set(rwys, no, rwydata); + naHash_set(rwys, rwyid, rwydata); } while(rwylst->next(&rwy)); }