Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

CJ4: FPLN does not add the complete airway #226

Closed
tscharlii opened this issue Oct 10, 2020 · 3 comments · Fixed by #235
Closed

CJ4: FPLN does not add the complete airway #226

tscharlii opened this issue Oct 10, 2020 · 3 comments · Fixed by #235
Labels
bug Something isn't working CJ4 Issues related to the CJ4 aircraft
Milestone

Comments

@tscharlii
Copy link
Contributor

tscharlii commented Oct 10, 2020

Starting from Fix NIK in Belgium: added Fix LAM in Great Britain via airway L610
Did not get the whole route but just a few fixes up until BULAM, which is on the airway L610 to LAM

Maybe because LAM is a sub string of BULAM?

@K20017
Copy link
Contributor

K20017 commented Oct 10, 2020

I would not be surprised if this is a nav database issue because one of our other members working on the G1000 was having a hard time with approach fixes that were related to LAM. The database doesn't list them correctly. For some reason, the in-game database for Europe seems funky and erroneous at times.

@tscharlii
Copy link
Contributor Author

tscharlii commented Oct 10, 2020

So the L610 route from NIK to LAM is:
NIK DENUT LUMEN BULAM DIBLI RAPIX SUNUP TEBRA KOPUL UNSAD NILON GILDA LAM

I think in this case the problem is the js code, not the airway database.
I suspect this line of code:

let lastWaypointIcao = airway.icaos.find(icao => { return icao.indexOf(lastWaypointIdent) !== -1; });

lastWaypointIdent is the exit fix, LAM in my case
airway.icaos are all the fixes on the airway

It checks, whether the the text "LAM" occurs in any of the airway fix names, and returns the first one found.
So if BULAM occurs before LAM in the airway icao list, it returns the index of BULAM.

Edit: The question is: Why did the author choose indexOf over an equality check. I suspect, there is a reason for that.

@dga711
Copy link
Member

dga711 commented Oct 10, 2020

ooof. good find! :D
Actually i suspected you hit another bug, where when you already have an approach selected the temporary flight plan will ommit the last waypoint of an airway. But then show it after EXEC (asobo!)

But this also makes sense.
Much of the code you'll find is modified Asobo code, as i mostly tend to stay as close as possible to their implementation (even though they suck at time ^^)
This function actually comes from Asobo, but they "forgot" to add the for loop to add all waypoints along an airway not just one 🤦 Thats why no plane in the game can add proper airways.

So I took it and modified it to produce the intended result.
I didn't catch that checking for indexOf could of course cause problems.

Will get fixed! Again, very good find! ;)

@dga711 dga711 added bug Something isn't working CJ4 Issues related to the CJ4 aircraft labels Oct 11, 2020
@dga711 dga711 mentioned this issue Oct 11, 2020
26 tasks
@dga711 dga711 added this to the CJ4 0.4.1 milestone Oct 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working CJ4 Issues related to the CJ4 aircraft
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants