Orbiter Beta r90 suspected bug with ShiftCG call and VC click-spots

jalexb88

Addon Developer
Addon Developer
Joined
Aug 11, 2008
Messages
152
Reaction score
154
Points
43
Location
Canada
Since a few months now NASSP has variable CG in the CSM+LM accomplished with ShiftCG(). We are now noticing issues with VC click-spot positions getting messed up only scenarios with both LM + CSM loaded in the session and only when the session is loaded already in the VC. The issue seems to be each vessel's ShiftCG call affecting the other vessel's VC click-spots.

In ShiftCG() as we can see here: https://github.com/orbitersim/orbit...c24e7124e051bfd0/Src/Orbiter/Vessel.cpp#L7631 it calls ShiftVC() which itself does things such as shift the VC click-spots. It seems to me that the issue might be ShiftCG() is shifting the click-spots of ALL the vessels in the session, and not just the intended one (the one where the ShiftCG() is called).

I made some tests outside of NASSP, using just stock orbiter vessels and this seems to have the issue as well... if you call a ShiftCG() from one vessel, it will change/corrupt the click-spots of every other vessel too in the session. Its hard to notice it because if you're in the vessel that calls the ShiftCG() obviously the click-spot shift is wanted and everything looks normal, but if you then switch to the other vessel, clbkLoadVC() will be called and it will correct the click-spots before you notice. But then from there quit/reload from the VC and your click-spots are messed up because your vessel does clbkLoadVC() before the other vessel does the ShiftCG().

Here is the issue: https://github.com/orbiternassp/NASSP/issues/671

I have looked through the Orbiter source code to see any potential clues but no luck so far, any ideas?
 
Last edited:

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,588
Reaction score
2,312
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Can this maybe be a factor in the problems we had in SSU with the VC action areas?
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,871
Reaction score
2,868
Points
188
Website
github.com
I have a massive headache and am pretty sleep deprived, but I think I understand what is going on: the click area data isn't contained in the local vessel classes but is instead in a global, single instance, class, so when a ShiftCG() call arrives, it updates the calling vessel parameters... and the click areas for the vessel in focus (or maybe for all vessels... I haven't figured it out completely).
Anyway, I think I've fixed it with a simple vessel check. Tomorrow I'll play a bit more with this and then I'll make a PR.

As for a way around this issue in a current Orbiter version, I'm out of ideas. :(
 

jalexb88

Addon Developer
Addon Developer
Joined
Aug 11, 2008
Messages
152
Reaction score
154
Points
43
Location
Canada
I have a massive headache and am pretty sleep deprived, but I think I understand what is going on: the click area data isn't contained in the local vessel classes but is instead in a global, single instance, class, so when a ShiftCG() call arrives, it updates the calling vessel parameters... and the click areas for the vessel in focus (or maybe for all vessels... I haven't figured it out completely).
Anyway, I think I've fixed it with a simple vessel check. Tomorrow I'll play a bit more with this and then I'll make a PR.

As for a way around this issue in a current Orbiter version, I'm out of ideas. :(

Thanks for checking this! Yeah I suspected it would be hard to figure out a work-around to make it work in r90, but if its easily fixable in the development version of Orbiter this is already very good news! :)
 
Top