From d86bdb0eab61b8952378508910c305fd38af63be Mon Sep 17 00:00:00 2001 From: glangford Date: Wed, 19 Aug 2015 11:11:53 -0400 Subject: [PATCH] Use associative array rather than linear search to find airport fixes --- assets/scripts/airport.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/assets/scripts/airport.js b/assets/scripts/airport.js index 495b6e5f..1bf8246b 100644 --- a/assets/scripts/airport.js +++ b/assets/scripts/airport.js @@ -207,7 +207,7 @@ var Airport=Fiber.extend(function() { if(data.fixes) { for(var i in data.fixes) { var coord = new Position(data.fixes[i], this.position); - this.fixes[i] = coord.position; + this.fixes[i.toUpperCase()] = coord.position; } } @@ -372,11 +372,7 @@ var Airport=Fiber.extend(function() { }, getFix: function(name) { if(!name) return null; - name = name.toLowerCase(); - for(var i in this.fixes) { - if(i.toLowerCase() == name) return this.fixes[i]; - } - return null; + return this.fixes[name.toUpperCase()] || null; }, getRunway: function(name) { if(!name) return null;