Skip to content

Mods are sorted alphabetically on all platforms.#968

Open
HELLISH666-warframe wants to merge 1 commit intoCodenameCrew:mainfrom
HELLISH666-warframe:patch-1
Open

Mods are sorted alphabetically on all platforms.#968
HELLISH666-warframe wants to merge 1 commit intoCodenameCrew:mainfrom
HELLISH666-warframe:patch-1

Conversation

@HELLISH666-warframe
Copy link
Copy Markdown

Very intricate code added right here!!111!!one11!!!

Very intricate code added right here!!111!!one11!!!
Copy link
Copy Markdown
Contributor

@r6915ee r6915ee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review comment attached below is primarily for if the pull request goes down this route.

My only major complaint is that this will sort the list each time the mods menu is opened. This might not affect small mods lists that much, but if the player has many mods installed, then this may be able to cause a noticeable slowdown.

What I would instead do is memoize the sorted list, alongside a hash of the concatenated mod directory names (preferably through an SHA-2 variant) and the last sorting mode used. Sorting and memoization would instead occur in getModsList. The last hash is compared against the current hash alongside the last sorting mode, and if any of them differ, then sorting would reoccur.

This could perhaps be furthered by storing these values together alongside with other variants, further improving performance. The main drawback would be increased memory usage, but memoization can perhaps be configured to use only a user-defined amount of entries.

FlxTween.tween(bg, {alpha: 0.5}, 0.25, {ease: FlxEase.cubeOut});

mods = ModsFolder.getModsList();
CoolUtil.sortAlphabetically(ModsFolder.getModsList(),true);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably shorten this line and line 32 into one by doing:

mods = CoolUtil.sortAlphabetically(ModsFolder.getModsList(), true);

Because sortAlphabetically returns the modified array, it's safe to directly use it as the value of mods.

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.

2 participants