1
0
Fork 0

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.)
This commit is contained in:
mfranz 2007-12-05 10:57:51 +00:00
parent 32dfdaea61
commit 98afaf4450

View file

@ -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<char *>(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<char *>(rwy._rwy_no.c_str()),
rwy._rwy_no.length());
naHash_set(rwys, no, rwydata);
naHash_set(rwys, rwyid, rwydata);
} while(rwylst->next(&rwy));
}