mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 05:07:10 +02:00
Improved sort of received star gifts.
This commit is contained in:
parent
321490e528
commit
28a79bfccb
1 changed files with 15 additions and 0 deletions
|
@ -681,6 +681,21 @@ void PreviewWrap::paintEvent(QPaintEvent *e) {
|
|||
for (auto &gift : gifts) {
|
||||
list.push_back({ .info = gift });
|
||||
}
|
||||
ranges::sort(list, [](
|
||||
const GiftTypeStars &a,
|
||||
const GiftTypeStars &b) {
|
||||
if (!a.info.limitedCount && !b.info.limitedCount) {
|
||||
return a.info.stars <= b.info.stars;
|
||||
} else if (!a.info.limitedCount) {
|
||||
return true;
|
||||
} else if (!b.info.limitedCount) {
|
||||
return false;
|
||||
} else if (a.info.limitedLeft != b.info.limitedLeft) {
|
||||
return a.info.limitedLeft > b.info.limitedLeft;
|
||||
}
|
||||
return a.info.stars <= b.info.stars;
|
||||
});
|
||||
|
||||
auto &map = Map[session];
|
||||
if (map.last != list) {
|
||||
map.last = list;
|
||||
|
|
Loading…
Add table
Reference in a new issue