albar965 / littlenavmap

Little Navmap is a free flight planner, navigation tool, moving map, airport search and airport information system for Flight Simulator X, Microsoft Flight Simulator 2020, Prepar3D and X-Plane.
https://albar965.github.io/littlenavmap.html
GNU General Public License v3.0
1.27k stars 164 forks source link

Waypoints getting deleted upon saving as LNMPLN file. #728

Closed icykoneko closed 3 years ago

icykoneko commented 3 years ago

I'm getting a very strange bug that seems to arbitrarily chop off waypoints in the flight plan upon saving as LNMPLN. After making the plan, I click the save icon and everything looks fine; however, the moment you click anywhere on the map, several waypoints disappear. Not only that, the saved plan doesn't have those waypoints either. The strange thing is, the Flight Plan window still has the waypoints, but they no longer point to the lost waypoints. See the pictures below. I've included the copy/pasted flight plan data below as well, and attached is the lnmpln file after saving.

I am able to continuously reproduce the issue by attempting to add VEXUB to the plan, then save. After clicking on the map, VEXUB vanishes once again!

Flight Plan:

Ident;Restriction ft/kts;Procedure;Type;Range nm;Distance nm;Remaining nm;Head- or Tailwind kts;longitude;latitude
EGHI;;Departure;;;0.0;64;;-1.35666668;50.95027924
WP1;;;;;0.5;63;▼ 14;-1.36135495;50.94209671
WP2;;;;;0.3;63;▼ 11;-1.36135495;50.93760681
WP3;;;;;0.2;63;▼ 3;-1.35753500;50.93436050
WP4;;;;;0.2;62;▲ 5;-1.35247099;50.93301010
WP5;;;;;0.3;62;▲ 13;-1.34547603;50.93390274
WP6;;;;;0.2;62;▲ 16;-1.34122705;50.93650055
WP7;;;;;0.2;62;▲ 13;-1.33989704;50.94052887
SAM;;;VORDME (H);195;0.9;61;▲ 9;-1.34505534;50.95524979
PEPIS;;;;;15.0;46;▲ 15;-1.24361110;51.19666672
WP8;;;;;2.0;44;▲ 17;-1.20893097;51.22301102
OCK20;;;;;9.0;35;▲ 14;-0.97289997;51.25175858
OCK17;;;;;3.0;32;▲ 14;-0.89513397;51.26094818
WP9;;;;;1.0;31;▲ 11;-0.86934102;51.26051712
WP10;;;;;1.0;30;▲ 5;-0.84668201;51.25331879
WP11;;;;;0.9;29;▼ 4;-0.83312100;51.24096298
R236;;;;;2.7;26;▼ 8;-0.80874997;51.19860077
WP12;;;;;0.9;25;▼ 3;-0.79467398;51.18666077
WP13;;;;;1.0;24;▲ 5;-0.77055502;51.17869568
WP14;;;;;0.8;23;▲ 11;-0.75004202;51.17761993
WP15;;;;;1.7;22;▲ 17;-0.71218598;51.19359970
VEXUB;;;;;4.5;17.2;▲ 16;-0.61277795;51.23583221
WP16;;;;;3.2;14.0;▲ 16;-0.54220599;51.26529694
WP17;;;;;1.5;12.5;▲ 16;-0.51722926;51.28457642
WP18;;;;;1.5;11.0;▲ 12;-0.51465434;51.30979919
WP19;;;;;1.5;9.5;▲ 5;-0.53405207;51.33093262
WP20;;;;;1.5;8.0;▼ 4;-0.57027262;51.34165955
CF24;2,000;Approach ILS FF24-Y;;;1.7;6.3;▼ 13;-0.61278909;51.33128738
FF24;2,000;Approach ILS FF24-Y;;;2.0;4.3;▼ 14;-0.65955567;51.31548691
RW24;270;Approach ILS FF24-Y;ILS/DME;;4.3;0.0;▼ 13;-0.76107258;51.28089142
RW24+1;/B 185;Missed ILS FF24-Y;;;1.0;;;-0.78459489;51.27306366
;A 910/B 185;Missed ILS FF24-Y;;;2.0;;;-0.83114594;51.25685501
;/B 185;Missed ILS FF24-Y;;;8.1;;;-0.61819482;51.23332596
VEXUB;3,000/B 185;Missed ILS FF24-Y;;;0.3;;;-0.61277795;51.23583221
EGLF;;Destination;;;;;;-0.77752233;51.27539063

OS: Windows 10 64-bit Sim: MSFS2020 (was inactive at the time - but using MSFS2020 scenery data) No addons in use for either airport. AIRAC Cycle: MSFS2020 Stock

From the log file:

[2021-07-03 20:25:27.888 DEBUG]: bool RouteController::saveFlightplanLnm() "D:/Users/USERNAME/Documents/Little Navmap Files/Flight Plans/World Tour - Europe/UK/EGHI-EGLF.lnmpln"
[2021-07-03 20:25:27.888 DEBUG]: void Route::removeLegs(int, int) removing from 21 to 26
[2021-07-03 20:25:27.888 DEBUG]: saveFlightplan undoIndex 12 undoIndexClean 12
[2021-07-03 20:25:27.888 DEBUG]: void MainWindow::updateActionStates()
[2021-07-03 20:25:27.888 DEBUG]: void MainWindow::saveFileHistoryStates()
[2021-07-03 20:25:27.888 DEBUG]: routeFileHistory
[2021-07-03 20:25:27.888 DEBUG]: kmlFileHistory
[2021-07-03 20:25:27.888 DEBUG]: layoutFileHistory
[2021-07-03 20:25:29.508 DEBUG]: void MapWidget::handleInfoClick(QPoint) QPoint(299,339)

That [2021-07-03 20:25:27.888 DEBUG]: void Route::removeLegs(int, int) removing from 21 to 26 line looks like the problem, but I don't know why it would remove those legs...

EGHI-EGLF-before-saving EGHI-EGLF-after-saving EGHI-EGLF.lnmpln.gz

albar965 commented 3 years ago

I thought this was fixed with c626d1079fd6f13386ef1a5d1961c9e7751278fb but apparently not. :slightly_frowning_face:

Will fix for 2.6.14

albar965 commented 3 years ago

BTW: Thanks for the perfect error report!

albar965 commented 3 years ago

Note about the log message: LNM removes waypoints which overlap with procedure waypoints when you add procedure. This is done to avoid a confusing zig-zag plan after adding a procedure.

Example: Provided you have your plan without the ILS approach but with waypoints FF24 and CF24 at EGLF . Adding I24-Y will remove both waypoints since they are already a part of the procedure.

This was a requested feature some time ago.