mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 09:32:29 +01:00
Move _guestGenerationProbability to GameState_t
This commit is contained in:
@@ -86,6 +86,14 @@ namespace OpenRCT2
|
||||
std::vector<ResearchItem> ResearchItemsUninvented;
|
||||
std::vector<ResearchItem> ResearchItemsInvented;
|
||||
uint8_t ResearchUncompletedCategories;
|
||||
|
||||
/**
|
||||
* Probability out of 65535, of gaining a new guest per game tick.
|
||||
* new guests per second = 40 * (probability / 65535)
|
||||
* With a full park rating, non-overpriced entrance fee, less guests than the suggested maximum and four positive
|
||||
* awards, approximately 1 guest per second can be generated (+60 guests in one minute).
|
||||
*/
|
||||
int32_t GuestGenerationProbability;
|
||||
};
|
||||
|
||||
GameState_t& GetGameState();
|
||||
|
||||
@@ -665,7 +665,9 @@ namespace OpenRCT2
|
||||
|
||||
bool SerialiseParkParameters(DataSerialiser& serialiser)
|
||||
{
|
||||
serialiser << _guestGenerationProbability;
|
||||
auto& gameState = GetGameState();
|
||||
|
||||
serialiser << gameState.GuestGenerationProbability;
|
||||
serialiser << _suggestedGuestMaximum;
|
||||
serialiser << gConfigGeneral.ShowRealNamesOfGuests;
|
||||
|
||||
|
||||
@@ -909,7 +909,7 @@ namespace OpenRCT2
|
||||
}
|
||||
cs.ReadWrite(gameState.NumGuestsInParkLastWeek);
|
||||
cs.ReadWrite(gGuestChangeModifier);
|
||||
cs.ReadWrite(_guestGenerationProbability);
|
||||
cs.ReadWrite(gameState.GuestGenerationProbability);
|
||||
cs.ReadWrite(_suggestedGuestMaximum);
|
||||
|
||||
cs.ReadWriteArray(gPeepWarningThrottle, [&cs](uint8_t& value) {
|
||||
|
||||
@@ -2194,7 +2194,7 @@ namespace RCT1
|
||||
gameState.GuestInitialThirst = _s4.GuestInitialThirst;
|
||||
gameState.GuestInitialHappiness = _s4.GuestInitialHappiness;
|
||||
|
||||
_guestGenerationProbability = _s4.GuestGenerationProbability;
|
||||
gameState.GuestGenerationProbability = _s4.GuestGenerationProbability;
|
||||
|
||||
// Staff colours
|
||||
gameState.StaffHandymanColour = RCT1::GetColour(_s4.HandymanColour);
|
||||
|
||||
@@ -338,7 +338,7 @@ namespace RCT2
|
||||
gameState.ResearchExpectedMonth = _s6.NextResearchExpectedMonth;
|
||||
gameState.GuestInitialHappiness = _s6.GuestInitialHappiness;
|
||||
gameState.ParkSize = _s6.ParkSize;
|
||||
_guestGenerationProbability = _s6.GuestGenerationProbability;
|
||||
gameState.GuestGenerationProbability = _s6.GuestGenerationProbability;
|
||||
gameState.TotalRideValueForMoney = _s6.TotalRideValueForMoney;
|
||||
gMaxBankLoan = ToMoney64(_s6.MaximumLoan);
|
||||
gameState.GuestInitialCash = ToMoney64(_s6.GuestInitialCash);
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace OpenRCT2::Scripting
|
||||
|
||||
int32_t ScPark::guestGenerationProbability_get() const
|
||||
{
|
||||
return _guestGenerationProbability;
|
||||
return GetGameState().GuestGenerationProbability;
|
||||
}
|
||||
|
||||
money64 ScPark::guestInitialCash_get() const
|
||||
|
||||
@@ -63,14 +63,6 @@ static int32_t _forcedParkRating = -1;
|
||||
*/
|
||||
uint32_t _suggestedGuestMaximum;
|
||||
|
||||
/**
|
||||
* Probability out of 65535, of gaining a new guest per game tick.
|
||||
* new guests per second = 40 * (probability / 65535)
|
||||
* With a full park rating, non-overpriced entrance fee, less guests than the suggested maximum and four positive awards,
|
||||
* approximately 1 guest per second can be generated (+60 guests in one minute).
|
||||
*/
|
||||
int32_t _guestGenerationProbability;
|
||||
|
||||
/**
|
||||
* Choose a random peep spawn and iterates through until defined spawn is found.
|
||||
*/
|
||||
@@ -259,7 +251,7 @@ void Park::Initialise()
|
||||
gameState.NumGuestsHeadingForPark = 0;
|
||||
gGuestChangeModifier = 0;
|
||||
gameState.ParkRating = 0;
|
||||
_guestGenerationProbability = 0;
|
||||
gameState.GuestGenerationProbability = 0;
|
||||
gameState.TotalRideValueForMoney = 0;
|
||||
_suggestedGuestMaximum = 0;
|
||||
gameState.ResearchLastItem = std::nullopt;
|
||||
@@ -321,7 +313,7 @@ void Park::Update(const Date& date)
|
||||
gCompanyValue = CalculateCompanyValue();
|
||||
gameState.TotalRideValueForMoney = CalculateTotalRideValueForMoney();
|
||||
_suggestedGuestMaximum = CalculateSuggestedMaxGuests();
|
||||
_guestGenerationProbability = CalculateGuestGenerationProbability();
|
||||
gameState.GuestGenerationProbability = CalculateGuestGenerationProbability();
|
||||
|
||||
WindowInvalidateByClass(WindowClass::Finances);
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_PARK_RATING);
|
||||
@@ -676,7 +668,7 @@ void Park::GenerateGuests()
|
||||
auto& gameState = GetGameState();
|
||||
|
||||
// Generate a new guest for some probability
|
||||
if (static_cast<int32_t>(ScenarioRand() & 0xFFFF) < _guestGenerationProbability)
|
||||
if (static_cast<int32_t>(ScenarioRand() & 0xFFFF) < gameState.GuestGenerationProbability)
|
||||
{
|
||||
bool difficultGeneration = (gameState.ParkFlags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) != 0;
|
||||
if (!difficultGeneration || _suggestedGuestMaximum + 150 >= gameState.NumGuestsInPark)
|
||||
|
||||
@@ -99,7 +99,6 @@ extern money64 gCompanyValue;
|
||||
|
||||
extern int16_t gParkRatingCasualtyPenalty;
|
||||
extern uint32_t gGuestsInParkHistory[32];
|
||||
extern int32_t _guestGenerationProbability;
|
||||
extern uint32_t _suggestedGuestMaximum;
|
||||
|
||||
void ParkSetForcedRating(int32_t rating);
|
||||
|
||||
Reference in New Issue
Block a user