Fix #15858: Purple and Pizza cheats do not affect the named guest

This commit is contained in:
Duncan 2021-11-04 22:16:53 +00:00 committed by GitHub
parent efa40b119a
commit de3d19a6b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 9 deletions

View File

@ -51,6 +51,7 @@
- Fix: [#15584] Ride income underflows when on-ride photos are making losses.
- Fix: [#15612] Crash when placing walls beside certain scenery objects.
- Fix: [#15851] Incorrect percentage chance of jumping with Katie Smith cheat.
- Fix: [#15858] Joanne Barton and Emma Garrell cheat incorrectly not applying effects to self.
- Improved: [#3417] Crash dumps are now placed in their own folder.
- Improved: [#13524] macOS arm64 native (universal) app
- Improved: [#15538] Software rendering can now draw in parallel when Multithreading is enabled.

View File

@ -38,7 +38,7 @@
// This string specifies which version of network stream current build uses.
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "17"
#define NETWORK_STREAM_VERSION "18"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
static Peep* _pickup_peep = nullptr;

View File

@ -456,7 +456,7 @@ static bool IsValidLocation(const CoordsXYZ& coords)
return false;
}
template<void (Guest::*EasterEggFunc)(Guest*)> static void ApplyEasterEggToNearbyGuests(Guest* guest)
template<void (Guest::*EasterEggFunc)(Guest*), bool applyToSelf> static void ApplyEasterEggToNearbyGuests(Guest* guest)
{
const auto guestLoc = guest->GetLocation();
if (!IsValidLocation(guestLoc))
@ -464,10 +464,13 @@ template<void (Guest::*EasterEggFunc)(Guest*)> static void ApplyEasterEggToNearb
for (auto* otherGuest : EntityTileList<Guest>(guestLoc))
{
if (otherGuest == guest)
if constexpr (!applyToSelf)
{
// Can not apply effect on self.
continue;
if (otherGuest == guest)
{
// Can not apply effect on self.
continue;
}
}
auto zDiff = std::abs(otherGuest->z - guestLoc.z);
if (zDiff <= 32)
@ -536,22 +539,22 @@ void Guest::UpdateEasterEggInteractions()
{
if (PeepFlags & PEEP_FLAGS_PURPLE)
{
ApplyEasterEggToNearbyGuests<&Guest::GivePassingPeepsPurpleClothes>(this);
ApplyEasterEggToNearbyGuests<&Guest::GivePassingPeepsPurpleClothes, true>(this);
}
if (PeepFlags & PEEP_FLAGS_PIZZA)
{
ApplyEasterEggToNearbyGuests<&Guest::GivePassingPeepsPizza>(this);
ApplyEasterEggToNearbyGuests<&Guest::GivePassingPeepsPizza, true>(this);
}
if (PeepFlags & PEEP_FLAGS_CONTAGIOUS)
{
ApplyEasterEggToNearbyGuests<&Guest::MakePassingPeepsSick>(this);
ApplyEasterEggToNearbyGuests<&Guest::MakePassingPeepsSick, false>(this);
}
if (PeepFlags & PEEP_FLAGS_ICE_CREAM)
{
ApplyEasterEggToNearbyGuests<&Guest::GivePassingPeepsIceCream>(this);
ApplyEasterEggToNearbyGuests<&Guest::GivePassingPeepsIceCream, false>(this);
}
if (PeepFlags & PEEP_FLAGS_JOY)