Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoring year is -1 when loading old savegame #8050

Closed
SamuXarick opened this issue Mar 30, 2020 · 4 comments · Fixed by #8512
Closed

Scoring year is -1 when loading old savegame #8050

SamuXarick opened this issue Mar 30, 2020 · 4 comments · Fixed by #8512
Labels
bug
Milestone

Comments

@SamuXarick
Copy link
Contributor

@SamuXarick SamuXarick commented Mar 30, 2020

Version of OpenTTD

1.10.0-RC1

Expected result

Set the old default scoring year

Actual result

scoring year is -1

Steps to reproduce

Load old savegame. I loaded "empty.sav", the regression savegame
Unnamed, 1954-11-16

@SamuXarick
Copy link
Contributor Author

@SamuXarick SamuXarick commented Mar 30, 2020

There's also another issue. Max year can go over 5000000:

  • Set the scoring year to 5000000
  • Start a game in 4999999
  • Fast forward and it goes past 5000000

@SamuXarick
Copy link
Contributor Author

@SamuXarick SamuXarick commented Mar 30, 2020

There's yet another issue. Start year can be 0.

  • Set the scoring year to Never
  • Start a game in 0
  • Fast forward and the score chart is shown

SamuXarick added a commit to SamuXarick/OpenTTD that referenced this issue Mar 30, 2020
- Ending year could lead date to go over 5000000.
- Never didn't work for year 0.
- Loading old savegames could set the variable to a value outside the allowed range (-1).
@LordAro
Copy link
Member

@LordAro LordAro commented Apr 4, 2020

as best as I can tell, _old_ending_year_slv_105 is never set, being left as default initialised to 0. The "old_ending_year_slv_105" setting has a default set to DEF_END_YEAR (2050, which is also wrong, as _old_ending... gets decremented before being used) but that's not being used at all.

I don't know enough about the settings system to know how the defaults are supposed to work...

@LordAro
Copy link
Member

@LordAro LordAro commented Apr 4, 2020

While we're in the same area,

SetDParam(0, ORIGINAL_END_YEAR);

could do with being changed to the settings year (the newspaper sprite is still wrong, but one thing at a time...)

SamuXarick added a commit to SamuXarick/OpenTTD that referenced this issue Dec 24, 2020
- Ending year could lead date to go over 5000000.
- Never didn't work for year 0.
- Loading old savegames could set the variable to a value outside the allowed range (-1).
@TrueBrain TrueBrain added this to the 1.11.0 milestone Jan 5, 2021
TrueBrain added a commit to TrueBrain/OpenTTD that referenced this issue Jan 7, 2021
…00001 and beyond

MAX_YEAR is set to 5000000, but having an ending-year set to the
same meant you could bypass this, and play till the uint32 wrapped.

The game can either show highscore or wrap year, not both. When
you would do both, every year you get the highscore dialog.

By changing the maximum value of ending-year to 4999999 we prevent
this issue.
TrueBrain added a commit to TrueBrain/OpenTTD that referenced this issue Jan 7, 2021
… you start in year zero

Using zero as "never" value can have its drawbacks ;)
@TrueBrain TrueBrain added the bug label Jan 7, 2021
TrueBrain added a commit that referenced this issue Jan 8, 2021
…nd beyond

MAX_YEAR is set to 5000000, but having an ending-year set to the
same meant you could bypass this, and play till the uint32 wrapped.

The game can either show highscore or wrap year, not both. When
you would do both, every year you get the highscore dialog.

By changing the maximum value of ending-year to 4999999 we prevent
this issue.
TrueBrain added a commit that referenced this issue Jan 8, 2021
…art in year zero

Using zero as "never" value can have its drawbacks ;)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants