From d977d3e6c42aa49cbc0c385fd8704aefb6233d44 Mon Sep 17 00:00:00 2001 From: Omar Aglan Date: Wed, 12 Aug 2026 01:48:34 +0300 Subject: [PATCH] fix: stop camera tracking hidden units --- .../Source/GameClient/GameClient.cpp | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index e396c3861b2..a71cc8e5dd2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -568,13 +568,27 @@ void GameClient::update() if (TheInGameUI->isCameraTrackingDrawable()) { + // TheSuperHackers @bugfix Omar Aglan 12/08/2026 Stop tracking a selected drawable + // as soon as it is no longer visible. Drawable *draw = TheInGameUI->getFirstSelectedDrawable(); - if ( draw ) + Object *object = draw ? draw->getObject() : nullptr; + Bool isVisible = object && !draw->isDrawableEffectivelyHidden(); + +#if ENABLE_CONFIGURABLE_SHROUD + if (isVisible && TheGlobalData->m_shroudOn) +#else + if (isVisible) +#endif { - TheTacticalView->userLookAt( draw->getPosition() ); + const Int playerIndex = rts::getObservedOrLocalPlayer()->getPlayerIndex(); + const ObjectShroudStatus shroudStatus = object->getShroudedStatus(playerIndex); + isVisible = shroudStatus == OBJECTSHROUD_CLEAR || shroudStatus == OBJECTSHROUD_PARTIAL_CLEAR; } + + if (isVisible) + TheTacticalView->userLookAt(draw->getPosition()); else - TheInGameUI->setCameraTrackingDrawable( FALSE ); + TheInGameUI->setCameraTrackingDrawable(FALSE); } if (m_intro != nullptr)