Skip to content

Commit

Permalink
FULLPIPE: Inherit GlobalMessageQueueList from Common::Array
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Sep 6, 2013
1 parent 7c8570d commit 1ed2069
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions engines/fullpipe/messages.cpp
Expand Up @@ -446,17 +446,17 @@ void MessageQueue::replaceKeyCode(int key1, int key2) {
}

MessageQueue *GlobalMessageQueueList::getMessageQueueById(int id) {
for (CPtrList::iterator s = begin(); s != end(); ++s) {
if (((MessageQueue *)*s)->_id == id)
return (MessageQueue *)*s;
for (Common::Array<MessageQueue *>::iterator s = begin(); s != end(); ++s) {
if ((*s)->_id == id)
return *s;
}

return 0;
}

void GlobalMessageQueueList::deleteQueueById(int id) {
for (uint i = 0; i < size(); i++)
if (((MessageQueue *)((*this).operator[](i)))->_id == id) {
if (_storage[i]->_id == id) {
remove_at(i);

disableQueueById(id);
Expand All @@ -466,8 +466,8 @@ void GlobalMessageQueueList::deleteQueueById(int id) {

void GlobalMessageQueueList::removeQueueById(int id) {
for (uint i = 0; i < size(); i++)
if (((MessageQueue *)((*this).operator[](i)))->_id == id) {
((MessageQueue *)((*this).operator[](i)))->_flags &= 0xFD; // It is quite pointless
if (_storage[i]->_id == id) {
_storage[i]->_flags &= 0xFD; // It is quite pointless
remove_at(i);

disableQueueById(id);
Expand All @@ -476,16 +476,16 @@ void GlobalMessageQueueList::removeQueueById(int id) {
}

void GlobalMessageQueueList::disableQueueById(int id) {
for (CPtrList::iterator s = begin(); s != end(); ++s) {
if (((MessageQueue *)*s)->_parId == id)
((MessageQueue *)*s)->_parId = 0;
for (Common::Array<MessageQueue *>::iterator s = begin(); s != end(); ++s) {
if ((*s)->_parId == id)
(*s)->_parId = 0;
}
}

int GlobalMessageQueueList::compact() {
for (uint i = 0; i < size();) {
if (((MessageQueue *)((*this).operator[](i)))->_isFinished) {
disableQueueById(((MessageQueue *)((*this).operator[](i)))->_id);
if (((MessageQueue *)_storage[i])->_isFinished) {
disableQueueById(_storage[i]->_id);
remove_at(i);
} else {
i++;
Expand Down
2 changes: 1 addition & 1 deletion engines/fullpipe/messages.h
Expand Up @@ -135,7 +135,7 @@ class MessageQueue : public CObject {
bool checkGlobalExCommandList2();
};

class GlobalMessageQueueList : public CPtrList {
class GlobalMessageQueueList : public Common::Array<MessageQueue *> {
public:
MessageQueue *getMessageQueueById(int id);
void deleteQueueById(int id);
Expand Down

0 comments on commit 1ed2069

Please sign in to comment.