mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 09:33:57 -07:00
[DeckAnalytics] Enforce WUBRGC ordering for analytics.
Took 6 minutes Took 7 seconds
This commit is contained in:
parent
0deaa9d9b4
commit
7ed98c40bb
6 changed files with 84 additions and 57 deletions
|
|
@ -56,6 +56,31 @@ inline QColor colorHelper(const QString &name)
|
|||
|
||||
return QColor(r, g, b);
|
||||
}
|
||||
inline QList<QPair<QString, int>> sortManaMapWUBRGCFirst(const QMap<QString, int> &input)
|
||||
{
|
||||
static const QStringList priorityOrder = {"W", "U", "B", "R", "G", "C"};
|
||||
|
||||
QList<QPair<QString, int>> result;
|
||||
QSet<QString> consumed;
|
||||
|
||||
// 1. Add priority colors in fixed order
|
||||
for (const QString &key : priorityOrder) {
|
||||
auto it = input.find(key);
|
||||
if (it != input.end()) {
|
||||
result.append({it.key(), it.value()});
|
||||
consumed.insert(it.key());
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Add remaining keys (QMap iteration is already sorted)
|
||||
for (auto it = input.begin(); it != input.end(); ++it) {
|
||||
if (!consumed.contains(it.key())) {
|
||||
result.append({it.key(), it.value()});
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
} // namespace MTG
|
||||
} // namespace GameSpecificColors
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue