Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upAdaptive perishable stacking #26523
Conversation
Qrox
reviewed
Nov 4, 2018
src/item.cpp Outdated
src/item.cpp Outdated
kevingranade
added some commits
Nov 4, 2018
kevingranade
force-pushed the
kevingranade:adaptive-perishable-stacking
branch
to
3afcbc0
Nov 6, 2018
Rivet-the-Zombie
merged commit 6af268c
into
CleverRaven:master
Nov 9, 2018
kevingranade
deleted the
kevingranade:adaptive-perishable-stacking
branch
Nov 9, 2018
kevingranade
referenced this pull request
Jan 10, 2019
Closed
Spoilable Items Clog Inventory Views #24498
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
kevingranade commentedNov 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.