diff --git a/src/ShipCockpit.cpp b/src/ShipCockpit.cpp index 64813eeb18d..d7d08c49df3 100644 --- a/src/ShipCockpit.cpp +++ b/src/ShipCockpit.cpp @@ -59,18 +59,18 @@ void ShipCockpit::Render(Graphics::Renderer *renderer, const Camera *camera, con inline void ShipCockpit::resetInternalCameraController() { - //Use dynamic_cast here to return NULL, if GetCameraController() returns derived CameraController class other than InternalCameraController - m_icc = dynamic_cast(Pi::game->GetWorldView()->shipView->GetCameraController()); + m_icc = static_cast(Pi::game->GetWorldView()->shipView->GetCameraController()); } void ShipCockpit::Update(const Player *player, float timeStep) { + //Check if current view is exterior since we don't need to update cockpit + //because player can't see it + if (Pi::game->GetWorldView()->shipView->IsExteriorView()) + { + return; + } if (m_icc == nullptr) { - //Check if current view is exterior, so resetInternalCameraController() will not set m_icc to NULL - if (Pi::game->GetWorldView()->shipView->IsExteriorView()) - { - return; - } // I don't know where to put this resetInternalCameraController(); }