-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fixed clamping order count in trading inventory #75849
Conversation
Ouch, i didn't expect we have non-POSIX targets. Could you advise me on the type to use instead of |
|
Fixing argument order alone won't make it work good since an unsigned integer overflow also happens here. |
Irrelevant because |
Clamping UINT_MAX produces another value than clamping -1, and it results in being unable to deselect items by holding |
You can also just keep it simple and revert d84cb31. It was snuck in a completely unrelated PR and the previous code worked fine AFAICT. |
Yeah, i agree that is a saner solution. @Brambor why the clamp? |
My bad. I see, it is not unsigned -1, but wrong order of arguments... Yeah, revert it. I only made it to be more readable. But it is wrong now, as you report. Sorry for the trouble I caused by "refactoring". |
fixes CleverRaven#75742 Found due to -D_GLIBCXX_ASSERTIONS, consider enabling it for experimental builds maybe? this reverts d84cb31
235d238
to
b1dfa05
Compare
force-pushed the reverting commit |
Summary
Bugfixes "Fixed clamping order count in trading inventory"
Purpose of change
fixes #75742
Describe the solution
Argument order and types were all wrong. Now they're right.
Describe alternatives you've considered
Keeping the yet-silent UB.
Testing
Tested on the saved game provided in the issue report.
Additional context
Found due to -D_GLIBCXX_ASSERTIONS, consider enabling it for experimental builds maybe?