1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Fix #22726: Force park rating cheat does not save

This commit is contained in:
RedMarcher
2024-11-23 13:03:18 -08:00
committed by GitHub
parent 4b259807af
commit 36f0ce04e7
5 changed files with 17 additions and 10 deletions

View File

@@ -4,6 +4,7 @@
- Improved: [#23051] Add large sloped turns and new inversions to the Twister, Vertical Drop, Hyper and Flying Roller Coasters.
- Improved: [#23123] Improve sorting of roller coasters in build new ride menu.
- Improved: [#23211] Add boosters to classic wooden roller coaster (cheats only).
- Fix: [#22726] Force park rating cheat is not saved with the park.
- Fix: [#23206] Multiplayer desyncs when FPS is uncapped.
- Fix: [#23238] Updating a guests favourite ride works differently from vanilla RCT2.

View File

@@ -57,6 +57,7 @@ void CheatsReset()
gameState.Cheats.AllowSpecialColourSchemes = false;
gameState.Cheats.MakeAllDestructible = false;
gameState.Cheats.SelectedStaffSpeed = StaffSpeedCheat::None;
gameState.Cheats.forcedParkRating = kForcedParkRatingDisabled;
}
void CheatsSet(CheatType cheatType, int64_t param1 /* = 0*/, int64_t param2 /* = 0*/)
@@ -115,6 +116,7 @@ void CheatsSerialise(DataSerialiser& ds)
CheatEntrySerialise(ds, CheatType::MakeDestructible, gameState.Cheats.MakeAllDestructible, count);
CheatEntrySerialise(ds, CheatType::SetStaffSpeed, gameState.Cheats.SelectedStaffSpeed, count);
CheatEntrySerialise(ds, CheatType::IgnorePrice, gameState.Cheats.IgnorePrice, count);
CheatEntrySerialise(ds, CheatType::SetForcedParkRating, gameState.Cheats.forcedParkRating, count);
// Remember current position and update count.
uint64_t endOffset = stream.GetPosition();
@@ -222,6 +224,8 @@ void CheatsSerialise(DataSerialiser& ds)
case CheatType::SetStaffSpeed:
ds << gameState.Cheats.SelectedStaffSpeed;
break;
case CheatType::SetForcedParkRating:
ds << gameState.Cheats.forcedParkRating;
default:
break;
}

View File

@@ -47,6 +47,7 @@ struct CheatsState
bool AllowSpecialColourSchemes;
bool MakeAllDestructible;
StaffSpeedCheat SelectedStaffSpeed;
int32_t forcedParkRating;
};
enum class CheatType : int32_t
@@ -134,6 +135,7 @@ constexpr int kCheatsDuckIncrement = 20;
constexpr int kCheatsStaffFastSpeed = 0xFF;
constexpr int kCheatsStaffNormalSpeed = 0x60;
constexpr int kCheatsStaffFreezeSpeed = 0;
constexpr int32_t kForcedParkRatingDisabled = -1;
void CheatsReset();
const char* CheatsGetName(CheatType cheatType);

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 = 2;
constexpr uint8_t kNetworkStreamVersion = 3;
const std::string kNetworkStreamID = std::string(OPENRCT2_VERSION) + "-" + std::to_string(kNetworkStreamVersion);

View File

@@ -49,9 +49,6 @@ using namespace OpenRCT2::Scripting;
namespace OpenRCT2::Park
{
// If this value is more than or equal to 0, the park rating is forced to this value. Used for cheat
static int32_t _forcedParkRating = -1;
static money64 calculateRideValue(const Ride& ride);
static money64 calculateTotalRideValueForMoney();
static uint32_t calculateSuggestedMaxGuests();
@@ -395,12 +392,13 @@ namespace OpenRCT2::Park
int32_t CalculateParkRating()
{
if (_forcedParkRating >= 0)
auto& gameState = GetGameState();
if (gameState.Cheats.forcedParkRating != kForcedParkRatingDisabled)
{
return _forcedParkRating;
return gameState.Cheats.forcedParkRating;
}
auto& gameState = GetGameState();
int32_t result = 1150;
if (gameState.Park.Flags & PARK_FLAGS_DIFFICULT_PARK_RATING)
{
@@ -734,15 +732,17 @@ namespace OpenRCT2::Park
void SetForcedRating(int32_t rating)
{
_forcedParkRating = rating;
GetGameState().Park.Rating = CalculateParkRating();
auto& gameState = GetGameState();
gameState.Cheats.forcedParkRating = rating;
gameState.Park.Rating = CalculateParkRating();
auto intent = Intent(INTENT_ACTION_UPDATE_PARK_RATING);
ContextBroadcastIntent(&intent);
}
int32_t GetForcedRating()
{
return _forcedParkRating;
return GetGameState().Cheats.forcedParkRating;
}
money64 GetEntranceFee()