mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-19 21:13:05 +01:00
Move gRideRatingUpdateStates to GameState_t
- Move gRideRatingUpdateStates variable to GameState_t - Remove RideRatingGetUpdateStates function
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "management/Finance.h"
|
||||
#include "management/NewsItem.h"
|
||||
#include "ride/Ride.h"
|
||||
#include "ride/RideRatings.h"
|
||||
#include "scenario/Scenario.h"
|
||||
#include "world/Banner.h"
|
||||
#include "world/Climate.h"
|
||||
@@ -92,6 +93,7 @@ namespace OpenRCT2
|
||||
std::vector<Banner> Banners;
|
||||
// Ride storage for all the rides in the park, rides with RideId::Null are considered free.
|
||||
std::array<Ride, OpenRCT2::Limits::MaxRidesInPark> Rides{};
|
||||
::RideRatingUpdateStates RideRatingUpdateStates;
|
||||
std::vector<TileElement> TileElements;
|
||||
|
||||
std::vector<ScenerySelection> RestrictedScenery;
|
||||
|
||||
@@ -552,7 +552,7 @@ namespace OpenRCT2
|
||||
cs.ReadWrite(gGrassSceneryTileLoopPosition);
|
||||
cs.ReadWrite(gWidePathTileLoopPosition);
|
||||
|
||||
auto& rideRatings = RideRatingGetUpdateStates();
|
||||
auto& rideRatings = gameState.RideRatingUpdateStates;
|
||||
if (os.GetHeader().TargetVersion >= 21)
|
||||
{
|
||||
cs.ReadWriteArray(rideRatings, [this, &cs](RideRatingUpdateState& calcData) {
|
||||
|
||||
@@ -1613,7 +1613,7 @@ namespace RCT2
|
||||
const auto& src = _s6.RideRatingsCalcData;
|
||||
// S6 has only one state, ensure we reset all states before reading the first one.
|
||||
RideRatingResetUpdateStates();
|
||||
auto& rideRatingStates = RideRatingGetUpdateStates();
|
||||
auto& rideRatingStates = GetGameState().RideRatingUpdateStates;
|
||||
auto& dst = rideRatingStates[0];
|
||||
dst = {};
|
||||
dst.Proximity = { src.ProximityX, src.ProximityY, src.ProximityZ };
|
||||
|
||||
@@ -78,8 +78,6 @@ struct ShelteredEights
|
||||
uint8_t TotalShelteredEighths;
|
||||
};
|
||||
|
||||
static RideRatingUpdateStates gRideRatingUpdateStates;
|
||||
|
||||
// Amount of updates allowed per updating state on the current tick.
|
||||
// The total amount would be MaxRideRatingSubSteps * RideRatingMaxUpdateStates which
|
||||
// would be currently 80, this is the worst case of sub-steps and may break out earlier.
|
||||
@@ -153,17 +151,13 @@ static void RideRatingsApplyRequirementStations(RatingTuple& ratings, const Ride
|
||||
static void RideRatingsApplyRequirementSplashdown(RatingTuple& ratings, const Ride& ride, RatingsModifier modifier);
|
||||
static void RideRatingsApplyPenaltyLateralGs(RatingTuple& ratings, const Ride& ride, RatingsModifier modifier);
|
||||
|
||||
RideRatingUpdateStates& RideRatingGetUpdateStates()
|
||||
{
|
||||
return gRideRatingUpdateStates;
|
||||
}
|
||||
|
||||
void RideRatingResetUpdateStates()
|
||||
{
|
||||
RideRatingUpdateState nullState{};
|
||||
nullState.State = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
|
||||
|
||||
std::fill(gRideRatingUpdateStates.begin(), gRideRatingUpdateStates.end(), nullState);
|
||||
auto& updateStates = GetGameState().RideRatingUpdateStates;
|
||||
std::fill(updateStates.begin(), updateStates.end(), nullState);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,7 +191,7 @@ void RideRatingsUpdateAll()
|
||||
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
|
||||
return;
|
||||
|
||||
for (auto& updateState : gRideRatingUpdateStates)
|
||||
for (auto& updateState : GetGameState().RideRatingUpdateStates)
|
||||
{
|
||||
for (size_t i = 0; i < MaxRideRatingUpdateSubSteps; ++i)
|
||||
{
|
||||
@@ -237,7 +231,8 @@ static void ride_ratings_update_state(RideRatingUpdateState& state)
|
||||
|
||||
static bool RideRatingIsUpdatingRide(RideId id)
|
||||
{
|
||||
return std::any_of(gRideRatingUpdateStates.begin(), gRideRatingUpdateStates.end(), [id](auto& state) {
|
||||
const auto& updateStates = GetGameState().RideRatingUpdateStates;
|
||||
return std::any_of(updateStates.begin(), updateStates.end(), [id](auto& state) {
|
||||
return state.CurrentRide == id && state.State != RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -55,10 +55,8 @@ struct RideRatingUpdateState
|
||||
};
|
||||
|
||||
static constexpr size_t RideRatingMaxUpdateStates = 4;
|
||||
|
||||
using RideRatingUpdateStates = std::array<RideRatingUpdateState, RideRatingMaxUpdateStates>;
|
||||
|
||||
RideRatingUpdateStates& RideRatingGetUpdateStates();
|
||||
void RideRatingResetUpdateStates();
|
||||
|
||||
void RideRatingsUpdateRide(const Ride& ride);
|
||||
|
||||
Reference in New Issue
Block a user