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

Fixed getting min/max drop values from deconstruction when modifier is NULL #75325

Merged
merged 3 commits into from
Aug 2, 2024
Merged

Fixed getting min/max drop values from deconstruction when modifier is NULL #75325

merged 3 commits into from
Aug 2, 2024

Conversation

achpile
Copy link
Contributor

@achpile achpile commented Jul 30, 2024

Summary

Bugfixes "Wrong information on furniture deconstruction"

Purpose of change

Fixes #75308

Function Single_item_creator::every_item_min_max() used modifier->count to get min/max amount of items you get from deconstruction.
Since modifier is std::optional it is not always provided

Describe the solution

Check if modifier is not NULL. If it is - we return [1,1] if item drop chance is 100 and [0,1] if it is less.

Describe alternatives you've considered

None

Testing

Tried to deconstruct heavy machinery and got perfect results

Additional context

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) json-styled JSON lint passed, label assigned by github actions labels Jul 30, 2024
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Jul 30, 2024
@zachary-kaelan
Copy link
Contributor

If there's any deconstruct test in the unit tests, this might be a good thing to add. If it can get broken once it can get broken again.

@achpile
Copy link
Contributor Author

achpile commented Jul 30, 2024

If there's any deconstruct test in the unit tests, this might be a good thing to add. If it can get broken once it can get broken again.

As far as I understand that part of the code - it affects only popup message output, not the deconstruction and it's results.

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jul 30, 2024
@dseguin dseguin merged commit 56ce45a into CleverRaven:master Aug 2, 2024
22 of 26 checks passed
@achpile achpile deleted the every_item_min_max branch August 2, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deconstructing heavy machinery can give negative 1 billion 60L tanks, among other weirdness
4 participants