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

Adaptive perishable stacking #26523

Merged

Conversation

Projects
None yet
4 participants
@kevingranade
Copy link
Member

commented Nov 4, 2018

Summary

SUMMARY: Interface "Adaptively stack perishables based on remaining time before rot."

Purpose of change

Fixes #25744
Since the massive extension of perishable durations, it has become possible to amass huge numbers of perishables with similar rot times that nevertheless are displayed seperately. This change causes these items with similar rot times to stack, and stack more coarsely the further in the future the rot time is.

Describe the solution

Extracted the code to produced truncated durations ("1 year", "three months", "2 days" etc) and used it to bucket items based on remaining time until spoilage.

Describe alternatives you've considered

Replacing the stacking code with menu code that dynamically stacks the items would be preferable, but is a much more involved change.
This uses a bucketing approach because the comparisons must be transitive. An approach where "items stack if they are within x% of each other" would be unstable and cause items to swap between stacks chaotically.

Additional context

Re-using the truncated time code minimises conflicts between stacks and displayed expiration times.

Show resolved Hide resolved src/item.cpp Outdated
Show resolved Hide resolved src/item.cpp Outdated

@kevingranade kevingranade force-pushed the kevingranade:adaptive-perishable-stacking branch to 3afcbc0 Nov 6, 2018

@Rivet-the-Zombie Rivet-the-Zombie merged commit 6af268c into CleverRaven:master Nov 9, 2018

4 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.05%) to 26.084%
Details
gorgon-ghprb Build finished.
Details

@kevingranade kevingranade deleted the kevingranade:adaptive-perishable-stacking branch Nov 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.