-
-
Notifications
You must be signed in to change notification settings - Fork 50
Fix bug 1411 - purchase of cargo was crashing #1507
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
base: master
Are you sure you want to change the base?
Conversation
as volume was 0 and there was a div by 0 error.
kheckwrecker
left a comment
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.
Looks good to me.
| // Check the maximum you can fit in your hold, but only if volume != 0 | ||
| if(item->GetVolume() > 0) { | ||
| int max_stackable_quantity = static_cast<int>(std::floor(hold->AvailableCapacity() / item->GetVolume())); | ||
| quantity = std::min(max_stackable_quantity, quantity); |
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.
shouldn't this also have a std::max with 0 so it doesn't go negative?
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.
So this is a bit complex. We have a 'mult_shady_moreupgrade' upgrade, which could show up as negative volume but for now is implemented as volume=0.1.
In reality, if we have a negative volume for actual upgrades, this will have issues elsewhere as well.
Better to fix this properly in cargo.
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.
while I agree we should fix it elsewhere too, we should also protect ourselves here as well.
- Prevent weapons from costing upgrade volume - Refactor concluseTransaction - Remove superfluous upgradeNotAddedToCargo function.
|
Last commit belongs in task_fix_1488. Reverting. |
This reverts commit c3b14b9.
as volume was 0 and there was a div by 0 error.
Closes #1411
Code Changes: