Skip to content

Commit

Permalink
Update ShipCockpit.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Max5377 authored Sep 27, 2023
1 parent 48b103c commit 81951d4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/ShipCockpit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<InternalCameraController *>(Pi::game->GetWorldView()->shipView->GetCameraController());
m_icc = static_cast<InternalCameraController *>(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();
}
Expand Down

0 comments on commit 81951d4

Please sign in to comment.