Skip to content

Conversation

@FuzzyGamesOn
Copy link
Collaborator

Related feature requests (might be more than this):
https://discord.com/channels/1097532591650910289/1219628970136571974
https://discord.com/channels/1097532591650910289/1166152300771950593

Having the items and locations be sorted is a long-requested feature, since their current orders are kinda arbitrary. So this PR sorts them both alphabetically. If we decide we want to sort them a different way later (or provide options to sort various ways), this at least sets the groundwork for any sort.

Sorting locations was the simple part of this. Basically a one-liner in a for loop.

Sorting items was the harder part of this. In the current client, we leave the existing item labels and only draw the new ones. To sort items easily, we have to instead redraw all of the item labels in their sorted name order. Unfortunately, this ran into an issue because our update function is called about 4-8 times per location send / item receive -- by us, UT, hints, etc. So the bold logic would work on the first update, then get overwritten by the subsequent ones.

So, this PR also includes functionality that buffers any update requests, then processes them all as a single request after a brief period of 1/4 of a second. Accidental but necessary performance boost 😃

@silasary silasary merged commit 898fc9c into main Dec 2, 2024
@silasary silasary deleted the client-sort-alphabetically branch December 2, 2024 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants