From 68914ea79a8c8a037136cf387833672db263d5e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 19 Jun 2025 00:31:30 +0200 Subject: [PATCH] Prevent unfollowing vehicles in viewports other than main Some viewports, like the one in the guest window or the ride window, are solely for the purpose of following a sprite. User could still try RMB-dragging in those windows, which would result in the viewport no longer following the sprite, but also not scrolling and simply getting stuck at whatever the latest position was. This change prevents allowing those viewports from unfollowing a sprite. --- distribution/changelog.txt | 1 + src/openrct2-ui/input/MouseInput.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 3c3b99be94..b1d0926329 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -17,6 +17,7 @@ - Fix: [#24589] Music tab doesn’t fully render in multiplayer. - Fix: [#24615] Blank strings in Windows installer. - Fix: [#24617] ‘Divide by zero’ error when updating boat hire acceleration. +- Fix: [#24626] Viewports that only follow sprites (e.g. in the Ride and Guest windows) can be made to unfollow them. 0.4.23 (2025-06-07) ------------------------------------------------------------------------ diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index 3ed57095d3..a35d492be0 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -551,7 +551,13 @@ namespace OpenRCT2 ContextHideCursor(); } - WindowUnfollowSprite(w); + // Only unfollow sprites for the main window or ‘extra viewport’ windows. + // Don’t unfollow for windows where the viewport is always supposed to follow (e.g. Ride, Guest, Staff). + auto mainWindow = WindowGetMain(); + if (&w == mainWindow || w.classification == WindowClass::Viewport) + { + WindowUnfollowSprite(w); + } // gInputFlags.set(InputFlag::unk5); }