[Scummvm-git-logs] scummvm master -> cc714bd989b4296ebdc8236aafaf5ea210536c3c

sev- noreply at scummvm.org
Sat Nov 18 18:17:51 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
cc714bd989 SLUDGE: Fix shadow flickering in frasse


Commit: cc714bd989b4296ebdc8236aafaf5ea210536c3c
    https://github.com/scummvm/scummvm/commit/cc714bd989b4296ebdc8236aafaf5ea210536c3c
Author: polyesterswing (kurianjojo2004 at gmail.com)
Date: 2023-11-18T19:17:47+01:00

Commit Message:
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.

Changed paths:
    engines/sludge/people.cpp


diff --git a/engines/sludge/people.cpp b/engines/sludge/people.cpp
index 61fe5253fc3..f4c2dc44397 100644
--- a/engines/sludge/people.cpp
+++ b/engines/sludge/people.cpp
@@ -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() {




More information about the Scummvm-git-logs mailing list