KSPModdingLibs / KSPCommunityFixes

Community patches for bugs in the KSP codebase
49 stars 17 forks source link

Investigate: switching to wrong vessel target from tracking station #221

Open JonnyOThan opened 4 months ago

JonnyOThan commented 4 months ago

I've seen this pretty often in TPKSP, although we use unusual methods to switch vessels there (KRPC, KOS). But I saw a report on reddit describing the same thing and I think I know the cause: https://www.reddit.com/r/KerbalAcademy/comments/1c0vwh2/a_few_annoying_glitches_that_make_my_life_suck/

I’m fairly sure this occurs when a vessel is deleted during the save/load process that occurs on scene switch. That usually happens when you hit the “max persistent debris” cap set in the main menu but there could be other sources as well.

I think this happens because FlightDriver.FocusVesselAfterLoad is just an index into the savegame's protoVessel list. If a debris or other craft is deleted at an earlier index after the target vessel index is captured, then it'll be pointing to the wrong vessel.

Need to set up a repro case and confirm.