[Scummvm-cvs-logs] scummvm master -> 6e6685a53de4f0f3deb4414f59153b2d6f673b6b
sev-
sev at scummvm.org
Tue Dec 10 21:24:23 CET 2013
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:
6e6685a53d FULLPIPE: Remove premature optimization in GlobalMessageQueueList::compact()
Commit: 6e6685a53de4f0f3deb4414f59153b2d6f673b6b
https://github.com/scummvm/scummvm/commit/6e6685a53de4f0f3deb4414f59153b2d6f673b6b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2013-12-10T12:22:51-08:00
Commit Message:
FULLPIPE: Remove premature optimization in GlobalMessageQueueList::compact()
This fixes freeze in intro and most probably tons of other stuff.
Kudos go to eriktorbjorn for debugging it.
Changed paths:
engines/fullpipe/messages.cpp
diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp
index 6af3f73..c28365a 100644
--- a/engines/fullpipe/messages.cpp
+++ b/engines/fullpipe/messages.cpp
@@ -557,16 +557,33 @@ void GlobalMessageQueueList::disableQueueById(int id) {
}
int GlobalMessageQueueList::compact() {
+ int *useList = new int[size() + 2];
+
+ for (uint i = 0; i < size() + 2; i++)
+ useList[i] = 0;
+
for (uint i = 0; i < size();) {
if (((MessageQueue *)_storage[i])->_isFinished) {
disableQueueById(_storage[i]->_id);
remove_at(i);
} else {
+ if (_storage[i]->_id < size() + 2)
+ useList[_storage[i]->_id] = 1;
i++;
}
}
- return size() + 1;
+ uint i;
+
+ for (i = 1; i < size() + 2; i++) {
+ if (!useList[i]) {
+ delete [] useList;
+
+ return i;
+ }
+ }
+
+ return i;
}
void GlobalMessageQueueList::addMessageQueue(MessageQueue *msg) {
More information about the Scummvm-git-logs
mailing list