Skip to content

Add sort to private inventories - #1148

Merged
WisoAltred merged 1 commit into
masterfrom
Fix-PrivateInventorySorting
Aug 18, 2026
Merged

Add sort to private inventories#1148
WisoAltred merged 1 commit into
masterfrom
Fix-PrivateInventorySorting

Conversation

@WisoAltred

Copy link
Copy Markdown
Contributor

Adds a sort before loading. resolves #1086.

@WisoAltred
WisoAltred requested a review from TrickyLeifa August 18, 2026 11:02
Comment thread src/evidence.cpp
foreach (QString evi, inventory.childGroups())
QStringList sortedInventory = inventory.childGroups();
std::sort(sortedInventory.begin(), sortedInventory.end(), [](const QString &a, const QString &b) { return a.toInt() < b.toInt(); });
foreach (QString evi, sortedInventory)

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.

If I can suggest anything, don't use Qt's keywords. Just use the proper for loop rather than foreach.

// before
foreach (QString evi, sortedInventory)

// after
for (const QString &group : std::as_const(sortedInventory))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is better in general, though for this particular case, I would offer that it can pass as is.

@WisoAltred WisoAltred changed the title Add sort Add sort to private inventories Aug 18, 2026
@WisoAltred
WisoAltred merged commit ea13f46 into master Aug 18, 2026
3 checks passed
@WisoAltred
WisoAltred deleted the Fix-PrivateInventorySorting branch August 18, 2026 11:11
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.

Saved inventories don't load in the order they were saved

2 participants