1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-02-02 03:35:09 +01:00

Fix #25879: Guest window viewport doesn't follow vehicle when on ride (#25883)

This commit is contained in:
frozensnowy
2026-01-31 14:41:20 +01:00
committed by GitHub
parent 3af94367ec
commit 75db9f34c4

View File

@@ -947,7 +947,16 @@ namespace OpenRCT2::Ui::Windows
const std::optional<Focus> currentFocus = peep->State != PeepState::picked ? std::optional(Focus(peep->Id))
: std::nullopt;
if (focus != currentFocus)
// Check if guest is in a vehicle (on ride, entering, or leaving but still on vehicle)
auto isGuestInVehicle = [&peep]() {
return peep->State == PeepState::onRide || peep->State == PeepState::enteringRide
|| (peep->State == PeepState::leavingRide && peep->x == kLocationNull);
};
// Also update when guest is on a ride but viewport still points to the guest (not the vehicle)
bool viewportNeedsVehicleUpdate = isGuestInVehicle() && viewportTargetSprite == EntityId::FromUnderlying(number);
if (focus != currentFocus || viewportNeedsVehicleUpdate)
{
onViewportRotate();
}