SLUDGE: Fix shadow flickering in frasse

Opening the action menu would cause frasse's shadow to flicker. It would
go on top and below the sprite.
This commit is contained in:
polyesterswing 2023-11-18 10:01:05 +05:30 committed by Eugene Sandulenko
parent b0c853c992
commit cc714bd989

View File

@ -474,11 +474,29 @@ struct PeopleYComperator {
}
};
template<typename T, class StrictWeakOrdering>
void bubble_sort(T first, T last, StrictWeakOrdering comp) {
bool swapped;
do {
swapped = false;
for (T i = first; i != last; ++i) {
T j = i;
++j;
if (j != last && comp(*j, *i)) {
SWAP(*i, *j);
swapped = true;
}
}
} while (swapped);
}
void PeopleManager::shufflePeople() {
if (_allPeople->empty())
return;
Common::sort(_allPeople->begin(), _allPeople->end(), PeopleYComperator());
// Use a stable sorting algorithm to sort people to avoid
// equal elements moving around and causing flickering issues
bubble_sort(_allPeople->begin(), _allPeople->end(), PeopleYComperator());
}
void PeopleManager::drawPeople() {