Fix #18151: Park value and company value are out of date after loading a save - #27065
Conversation
6b64b6c to
5b9cb63
Compare
|
Is company value not stored in the save file or does it get overwritten upon load? |
See my comment here: #18151 (comment) |
|
I see. I'm fine with scenarioSuccess calculating things that might be outdated due to wait for ticks/period such that completion has it right, nevertheless I think game init should make sure all periodic stats are properly initialized as to not depend on this |
5b9cb63 to
7bce843
Compare
I've amended the commit and update the description with a new setup, does this address this? |
tupaschoal
left a comment
There was a problem hiding this comment.
This is more in line with what I was thinking. If the reasoning for updating every 13s is right, parks can still finish with an outdated valuation, although I understand it will be less outdated now
| @@ -87,8 +87,7 @@ void ScenarioReset(GameState_t& gameState) | |||
|
|
|||
| auto& park = gameState.park; | |||
| park.rating = Park::CalculateParkRating(park, gameState); | |||
There was a problem hiding this comment.
See the PR description, this would otherwise influence ScenarioRand right?
There was a problem hiding this comment.
I don't know, but if you concluded that, probably worth leaving a comment to warn people to leave it alone
|
|
||
| // Park::Update only recalculates these every ~13 seconds, so a save can hold a value that | ||
| // predates this park being loaded. Scenarios get the same treatment from ScenarioReset. | ||
| Park::updateValuations(gameState.park, gameState); |
There was a problem hiding this comment.
I would have put this inside gameLoadInit, any reason why you didn't do it?
There was a problem hiding this comment.
I had a feeling it might cause desyncs in that case as the server and client would disagree? Would be a true edge-case though.
There was a problem hiding this comment.
Hmm, I don't wanddr enough into multiplayer to answer confidently. This is called just after init, wouldn't it happen anyway?
| int32_t CalculateParkRating(const ParkData& park, const GameState_t& gameState); | ||
| money64 CalculateParkValue(const ParkData& park, const GameState_t& gameState); | ||
| money64 CalculateCompanyValue(const ParkData& park); | ||
| void updateValuations(ParkData& park, const GameState_t& gameState); |
There was a problem hiding this comment.
| void updateValuations(ParkData& park, const GameState_t& gameState); | |
| void UpdateValuations(ParkData& park, const GameState_t& gameState); |
To follow naming convention of the file
There was a problem hiding this comment.
I was told before that new additions should follow the "new" naming conventions, no matter what pre-existed in the file. Is that not correct?
There was a problem hiding this comment.
You're probably right. I didn't keep up with all the renames, if this is the current style, feel free to mark the issue as resolved.
Description of changes
Fixes #18151. Recalculate the park value and the company value when a saved game is loaded, instead of using whatever the file stored.
Rationale behind changes
Both are only recalculated every 512 ticks.
ScenarioResetrefreshes them when a scenario begins, but loading a saved game never goes through it, so the park keeps the figures that came out of the file until the first periodic tick. For an RCT1 save that park value used the RCT1 formula, and a scenario completing in those few seconds records it as the score.The park rating is left alone: RCT1 imports it as-is, and
calculateGuestGenerationProbabilitystarts from it and is compared againstScenarioRand, so refreshing it on load would change guest generation in every existing save.Suggested testing steps
Load an RCT1 save and compare the company value in the finances window the moment it opens with the one it settles on seconds later. They should now match.
The save in #18151 no longer wins on its own, since Windstorm dropped just under the required 7.00 excitement when #18146 gave the Classic Wooden Roller Coaster its own ratings. Raising that locally makes it win on load again, and the score goes from roughly €41,500 to €386,626.
Did you use AI to help find, test, or implement this issue or feature?
Yes. Claude Opus 5 (high reasoning effort) assisted with investigating the reported issue, analysing the code, and drafting the accompanying text. Suggestions were not taken as-is: what to change, and how, was settled over several rounds of back and forth, and based on existing patterns in the code base plus my own knowledge. All changes have been verified by me in-game or with the project's own tooling, and I take responsibility for the diff.