From de3d19a6b8a31857bd833c89a4d9f469965790be Mon Sep 17 00:00:00 2001 From: Duncan Date: Thu, 4 Nov 2021 22:16:53 +0000 Subject: [PATCH] Fix #15858: Purple and Pizza cheats do not affect the named guest --- distribution/changelog.txt | 1 + src/openrct2/network/NetworkBase.cpp | 2 +- src/openrct2/peep/Guest.cpp | 19 +++++++++++-------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 4fafdaae67..b02474d504 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -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. diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index fa5439089d..ecb0b72df5 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -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; diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 670cd8bb91..f9b3297fbd 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -456,7 +456,7 @@ static bool IsValidLocation(const CoordsXYZ& coords) return false; } -template static void ApplyEasterEggToNearbyGuests(Guest* guest) +template static void ApplyEasterEggToNearbyGuests(Guest* guest) { const auto guestLoc = guest->GetLocation(); if (!IsValidLocation(guestLoc)) @@ -464,10 +464,13 @@ template static void ApplyEasterEggToNearb for (auto* otherGuest : EntityTileList(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)