forked from rosebudai/OpenRCT2-Web
Prevent ride ratings from invalidating ride windows unnecessarily
This commit is contained in:
1 parent
a47ee3f7de
commit
3c9136ac4f
5 files changed
+16
-4
No files matched your search
@@ -5511,6 +5511,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
frame_no++;
|
||||
OnPrepareDraw();
|
||||
InvalidateWidget(WIDX_TAB_7);
|
||||
|
||||
Ride* const ride = GetRide(rideId);
|
||||
if (ride && ride->windowInvalidateFlags & RIDE_INVALIDATE_RIDE_RATINGS)
|
||||
{
|
||||
Invalidate();
|
||||
ride->windowInvalidateFlags &= ~RIDE_INVALIDATE_RIDE_RATINGS;
|
||||
}
|
||||
}
|
||||
|
||||
void MeasurementsOnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
|
||||
|
||||
@@ -797,6 +797,7 @@ enum
|
||||
RIDE_INVALIDATE_RIDE_OPERATING = 1 << 4,
|
||||
RIDE_INVALIDATE_RIDE_MAINTENANCE = 1 << 5,
|
||||
RIDE_INVALIDATE_RIDE_MUSIC = 1 << 6,
|
||||
RIDE_INVALIDATE_RIDE_RATINGS = 1 << 7,
|
||||
};
|
||||
|
||||
enum
|
||||
|
||||
@@ -433,9 +433,6 @@ static void ride_ratings_update_state_3(RideRatingUpdateState& state)
|
||||
RideRatingsCalculate(state, *ride);
|
||||
RideRatingsCalculateValue(*ride);
|
||||
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->InvalidateByNumber(WindowClass::Ride, state.CurrentRide.ToUnderlying());
|
||||
|
||||
state.State = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
|
||||
}
|
||||
|
||||
@@ -1049,7 +1046,11 @@ static void RideRatingsCalculate(RideRatingUpdateState& state, Ride& ride)
|
||||
// Universl ratings adjustments
|
||||
RideRatingsApplyIntensityPenalty(ratings);
|
||||
RideRatingsApplyAdjustments(ride, ratings);
|
||||
ride.ratings = ratings;
|
||||
if (ride.ratings != ratings)
|
||||
{
|
||||
ride.ratings = ratings;
|
||||
ride.windowInvalidateFlags |= RIDE_INVALIDATE_RIDE_RATINGS;
|
||||
}
|
||||
|
||||
ride.upkeepCost = RideComputeUpkeep(state, ride);
|
||||
ride.windowInvalidateFlags |= RIDE_INVALIDATE_RIDE_INCOME;
|
||||
|
||||
@@ -39,6 +39,8 @@ struct RatingTuple
|
||||
|
||||
bool isNull() const;
|
||||
void setNull();
|
||||
|
||||
bool operator==(const RatingTuple& rhs) const = default;
|
||||
};
|
||||
static_assert(sizeof(RatingTuple) == 6);
|
||||
|
||||
|
||||
@@ -2318,6 +2318,7 @@ static void test_finish(Ride& ride)
|
||||
{
|
||||
ride.lifecycleFlags &= ~RIDE_LIFECYCLE_TEST_IN_PROGRESS;
|
||||
ride.lifecycleFlags |= RIDE_LIFECYCLE_TESTED;
|
||||
ride.windowInvalidateFlags |= RIDE_INVALIDATE_RIDE_RATINGS;
|
||||
|
||||
auto rideStations = ride.getStations();
|
||||
for (int32_t i = ride.numStations - 1; i >= 1; i--)
|
||||
|
||||
Reference in new issue
Block a user