-
-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for glued cockpit #5631
Fix for glued cockpit #5631
Conversation
If there is now no codepath that calls |
Makes sense with a type-checking before casting. I will change this back to |
I have no intentions to further improve ShipCockpit.cpp. It is the last file in the codebase from the Paragon/Jumpdrive codebase (as indicated by the Meteoric Games copyright header), has many significant deficiencies/bugs, and is pending a complete replacement with a "clean-room" implementation of ship cockpit view that's being developed in my clickable cockpits branch. You are welcome to make any changes to it that you deem necessary to improve performance or reduce unnecessary computation - however given that it will be completely gone in 1-2 releases I'm not going to ask you to spend any further time on it if you don't want to. Were this another part of the code that isn't in "pending removal" state, I'd say go for it. 😄 |
Fixes issue when cockpit becomes "glued" on random occasions.
81951d4
to
a128b00
Compare
Changed |
Looks good! I'll test this in a few days in the same batch as your other PRs and (most likely) merge all three at once. |
@Max5377 Please let us know if you want to be in AUTHORS.txt (and what to put there). Also: good work with the bug fixes! |
@impaktor Yes, you can add me in AUTHORS.txt. I write later what to add here, need to think about it. You are welcome. |
Fixes #5621
This happened, because there was no check in this statement in
void ShipCockpit::Update(const Player *player, float timeStep)
:if (m_icc == nullptr)
,if current
CameraController
is reallyInternalCameraController
. Because of that, this statement ininline void ShipCockpit::resetInternalCameraController()
:m_icc = static_cast<InternalCameraController *>(Pi::game->GetWorldView()->shipView->GetCameraController());
,would cast current
CameraController
to invalid type if it was notInternalCameraController
, which is undefined behaviour.Added check at the start of
Update
if current view is exterior to ensure that currentCameraController
is reallyInternalCameraController
.