Check for max number of tile items when moving in sorting #37258
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.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: Bugfixes "Check for max number of tile items when moving in sorting"
Purpose of change
Fixes #35398
Describe the solution
So I couldnt actually reproduce the infinite looping issue in the linked issue, the activity just dumped the items on the tile next to the target tile that had 4096 items in it.
But this uncovered another problem - if the entire area was covered in unsorted zones, then when it overflowed, it tried to sort it again, and when it did, the item just disappeared, gone.
This fix stops that happening, and also should stop any occurence of infinite looping as per the linked issue, even though I couldnt get that to trigger.
Basically it checks if the number of items on that tile is more than
MAX_ITEM_IN_SQUARE
and if it is, it bails out.Describe alternatives you've considered
N/A
Testing
Put 4096 cig butts down on a tile that was a spare parts and other loot zone, put unsorted loot zone around it in a 10x10 square.
Placed scrap metals everywhere in the unsorted zones, pressed shit+o - sort.
It didnt do anything, because the target tile had reached max items.
Additional context
N/A