1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-17 21:12:34 +01:00

Fix #23238: Guest ride favourite mistake

Mistake made during implementation.
This commit is contained in:
Duncan
2024-11-23 10:39:17 +00:00
committed by GitHub
parent 290b39ade2
commit 759d850e56
5 changed files with 17 additions and 16 deletions

View File

@@ -81,9 +81,9 @@ set(OPENMSX_VERSION "1.6")
set(OPENMSX_URL "https://github.com/OpenRCT2/OpenMusic/releases/download/v${OPENMSX_VERSION}/openmusic.zip")
set(OPENMSX_SHA1 "ba170fa6d777b309c15420f4b6eb3fa25082a9d1")
set(REPLAYS_VERSION "0.0.83")
set(REPLAYS_VERSION "0.0.84")
set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v${REPLAYS_VERSION}/replays.zip")
set(REPLAYS_SHA1 "FFC98C36AFEC68DC6A48E863413D4E2364A202B3")
set(REPLAYS_SHA1 "90B848AB344E29A2CF1E3E48539F06F5845772C3")
option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.")
option(WITH_TESTS "Build tests")

View File

@@ -5,6 +5,7 @@
- Improved: [#23123] Improve sorting of roller coasters in build new ride menu.
- Improved: [#23211] Add boosters to classic wooden roller coaster (cheats only).
- Fix: [#23206] Multiplayer desyncs when FPS is uncapped.
- Fix: [#23238] Updating a guests favourite ride works differently from vanilla RCT2.
0.4.16 (2024-11-03)
------------------------------------------------------------------------

View File

@@ -51,8 +51,8 @@
<OpenSFXSha1>b1b1f1b241d2cbff63a1889c4dc5a09bdf769bfb</OpenSFXSha1>
<OpenMSXUrl>https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6/openmusic.zip</OpenMSXUrl>
<OpenMSXSha1>ba170fa6d777b309c15420f4b6eb3fa25082a9d1</OpenMSXSha1>
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.83/replays.zip</ReplaysUrl>
<ReplaysSha1>FFC98C36AFEC68DC6A48E863413D4E2364A202B3</ReplaysSha1>
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.84/replays.zip</ReplaysUrl>
<ReplaysSha1>90B848AB344E29A2CF1E3E48539F06F5845772C3</ReplaysSha1>
</PropertyGroup>
<ItemGroup>

View File

@@ -440,7 +440,7 @@ static void PeepRideIsTooIntense(Guest* peep, Ride& ride, bool peepAtRide);
static void PeepResetRideHeading(Guest* peep);
static void PeepTriedToEnterFullQueue(Guest* peep, Ride& ride);
static int16_t PeepCalculateRideSatisfaction(Guest* peep, const Ride& ride);
static void PeepUpdateFavouriteRide(Guest* peep, const Ride& ride);
static void GuestUpdateFavouriteRide(Guest& peep, const Ride& ride, const uint8_t satisfaction);
static int16_t PeepCalculateRideValueSatisfaction(Guest* peep, const Ride& ride);
static int16_t PeepCalculateRideIntensityNauseaSatisfaction(Guest* peep, const Ride& ride);
static void PeepUpdateRideNauseaGrowth(Guest* peep, const Ride& ride);
@@ -1761,7 +1761,7 @@ void Guest::OnEnterRide(Ride& ride)
GuestNumRides++;
SetHasRidden(ride);
PeepUpdateFavouriteRide(this, ride);
GuestUpdateFavouriteRide(*this, ride, satisfaction);
HappinessTarget = std::clamp(HappinessTarget + satisfaction, 0, kPeepMaxHappiness);
PeepUpdateRideNauseaGrowth(this, ride);
}
@@ -2703,24 +2703,24 @@ static int16_t PeepCalculateRideSatisfaction(Guest* peep, const Ride& ride)
/**
* Check to see if the specified ride should become the peep's favourite.
* For this, a "ride rating" is calculated based on the excitement of the ride and the peep's current happiness.
* As this value cannot exceed 255, the happier the peep is, the more irrelevant the ride's excitement becomes.
* For this, a "ride rating" is calculated based on the excitement of the ride and the satisfaction of the ride.
* As this value cannot exceed 255, the more satisfied the peep is, the more irrelevant the ride's excitement becomes.
* Due to the minimum happiness requirement, an excitement rating of more than 3.8 has no further effect.
*
* If the ride rating is higher than any ride the peep has already been on and the happiness criteria is met,
* the ride becomes the peep's favourite. (This doesn't happen right away, but will be updated once the peep
* exits the ride.)
*/
static void PeepUpdateFavouriteRide(Guest* peep, const Ride& ride)
static void GuestUpdateFavouriteRide(Guest& peep, const Ride& ride, uint8_t satisfaction)
{
peep->PeepFlags &= ~PEEP_FLAGS_RIDE_SHOULD_BE_MARKED_AS_FAVOURITE;
uint8_t peepRideRating = std::clamp((ride.ratings.excitement / 4) + peep->Happiness, 0, kPeepMaxHappiness);
if (peepRideRating >= peep->FavouriteRideRating)
peep.PeepFlags &= ~PEEP_FLAGS_RIDE_SHOULD_BE_MARKED_AS_FAVOURITE;
uint8_t peepRideRating = std::clamp((ride.ratings.excitement / 4) + satisfaction, 0, kPeepMaxHappiness);
if (peepRideRating >= peep.FavouriteRideRating)
{
if (peep->Happiness >= 160 && peep->HappinessTarget >= 160)
if (peep.Happiness >= 160 && peep.HappinessTarget >= 160)
{
peep->FavouriteRideRating = peepRideRating;
peep->PeepFlags |= PEEP_FLAGS_RIDE_SHOULD_BE_MARKED_AS_FAVOURITE;
peep.FavouriteRideRating = peepRideRating;
peep.PeepFlags |= PEEP_FLAGS_RIDE_SHOULD_BE_MARKED_AS_FAVOURITE;
}
}
}

View File

@@ -49,7 +49,7 @@ using namespace OpenRCT2;
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
constexpr uint8_t kNetworkStreamVersion = 1;
constexpr uint8_t kNetworkStreamVersion = 2;
const std::string kNetworkStreamID = std::string(OPENRCT2_VERSION) + "-" + std::to_string(kNetworkStreamVersion);