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
Fix #10469, 5e14a20: [Script] League Table rating element is a int64 everywhere else #10471
Fix #10469, 5e14a20: [Script] League Table rating element is a int64 everywhere else #10471
Conversation
45a9d65
to
5bed5e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember why it ended up with different types. Probably I changed it at some point and missed one place. At the end of the day it's just an arbitrary field only used for sorting so it doesn't matter much what type it is. But as GS types are signed having it stored as signed as well makes more sense. Probably GS methods can even accept SQInteger or whatever is GS type called. But as SQInteger isn't used in other functions yet it's probably fine to leave it as int64 is for this PR.
Also, savegame conversion stuff and version bump is logically redundant as it is just a int64 stored in that uint64 anyway. But I don't know of a better way to express that in the new save format so I guess it's fine as it is.
I don't think any changes in the savegame stuff is needed, using SLE_UINT64 for an int64 should work fine. |
It feels kinda dumb to have to use a wrong type to bypass a type check. |
79a8318
to
29cec53
Compare
There is a middle ground solution |
… int64 everywhere else
29cec53
to
46a5a55
Compare
Backport can only be partial due to savegame bump, but uint64 -> int64 itself can go to release branch I think. |
Hmm, true. How to annotate that for the poor soul that's going to try to backport? |
Motivation / Problem
Closes #10469
Rating is a int64 in the Cmd functions, in the script API functions, but not on the league table element struct. Sorting through negative values would cause 0 to be below them.
Description
Turn rating in struct into int64, and add savegame bump and conversion.
Limitations
Probably will cause issues if the values saved on an old savegame were already above INT64_MAX to begin with, they would turn negative after load, most likely.
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.