Parse aircraft type codes

This commit is contained in:
Carlos Salaverria 2016-08-26 16:22:14 -05:00
parent 08ffda1aa8
commit 812de53ec1

View file

@ -85,10 +85,14 @@ function getIcaoAircraftTypeData(aircraftData, defer) {
function lookupIcaoAircraftType(aircraftData, defer) {
if (_aircraft_type_cache !== null && "t" in aircraftData) {
var typeDesignator = aircraftData["t"].toUpperCase();
var typeDesignator = aircraftData.t.toUpperCase();
if (typeDesignator in _aircraft_type_cache) {
var typeData = _aircraft_type_cache[typeDesignator];
aircraftData.desc = typeData.desc;
if (typeData.desc != undefined && typeData.desc != null && typeData.desc.length == 3) {
aircraftData.aircraftTypeCode = typeData.desc.charAt(0);
aircraftData.engineCount = parseInt(typeData.desc.charAt(1));
aircraftData.engineTypeCode = typeData.desc.charAt(2);
}
aircraftData.wtc = typeData.wtc;
}
}