zlsa / atc

https://openscope.co/
342 stars 107 forks source link

Unlimited Restricted Airspace Displayed as FLNaN #756

Closed Fechulo closed 7 years ago

Fechulo commented 7 years ago

When the ceiling of restricted airspace is unlimited, it is displayed as FLNaN in the game, instead of UNL. It can be seen at UUDD: flnan

n8rzz commented 7 years ago

@Fechulo @erikquinn That is because it's trying to parse a string 'Unlimited' which is obviously, not a number.

This should, hopefully, be an easy fix. Should it display FL UNL or just UNL?

n8rzz commented 7 years ago

never mind, I found it.

n8rzz commented 7 years ago

@Fechulo is this the first you noticed this issue? From what I can tell, this much have been an issue for quite a while. Oh well, it's going to be addressed for v3.2.0.

Fechulo commented 7 years ago

@n8rzz I believe it should just display 'UNL'. This was definitely working before v3 but I'm not sure when it stopped working. There's very few airports in the game that have restricted airspace with an unlimited ceiling, so I found it today while working on El Paso Intl.

n8rzz commented 7 years ago

@Fechulo right on, I think there were two airports that came up when I searched. I'm sure I got a little jumpy refactoring and something was missed. In fact, thats my assumption here.

Good news is that there are now specific tests for this case, so once the bugfix is completed we will know that this case is covered with tests.

erikquinn commented 7 years ago

@n8rzz does Infinity parse properly as a number? Perhaps using that in the file instead of unlimited would yield an equally acceptable result without necessitating complications to the logic for this one case? Either way. I do agree with @Fechulo though, definitely UNL of the two or 999 or 600 (the top of controlled airspace is more of less considered to be FL600, where the jet airways are no longer usable).

n8rzz commented 7 years ago

@erikquinn parseFloat(Infinity) will output Infinity. The problem here, is that infinity is being passed as a string and not a number (Infinity is a number in javascript):

parseFloat(Infinity) -> Infinity
parseFloat('Infinity') -> NaN

As far the FL and the UNL, that is already implemented within the CanvasController but because the height value is NaN by the time it gets there, the ternary thinks is supposed to be a FL.

const height = (area.height === Infinity ? 'UNL' : 'FL' + Math.ceil(area.height / 1000) * 10);
erikquinn commented 7 years ago

Resolved by #755. Closing.