aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/pegasus/notification.cpp26
-rw-r--r--engines/pegasus/notification.h3
2 files changed, 15 insertions, 14 deletions
diff --git a/engines/pegasus/notification.cpp b/engines/pegasus/notification.cpp
index 91a876cb67..4179afa70d 100644
--- a/engines/pegasus/notification.cpp
+++ b/engines/pegasus/notification.cpp
@@ -38,8 +38,8 @@ Notification::Notification(const NotificationID id, NotificationManager *owner)
}
Notification::~Notification() {
- for (ReceiverIterator it = _receivers.begin(); it != _receivers.end(); it++)
- it->receiver->newNotification(NULL);
+ for (uint i = 0; i < _receivers.size(); i++)
+ _receivers[i].receiver->newNotification(NULL);
if (_owner)
_owner->removeNotification(this);
@@ -49,9 +49,9 @@ Notification::~Notification() {
// Wherever mask is 0, leave existing bits untouched.
// Wherever mask is 1, set bit equivalent to flags.
void Notification::notifyMe(NotificationReceiver *receiver, NotificationFlags flags, NotificationFlags mask) {
- for (ReceiverIterator it = _receivers.begin(); it != _receivers.end(); it++) {
- if (it->receiver == receiver) {
- it->mask = (it->mask & ~mask) | (flags & mask);
+ for (uint i = 0; i < _receivers.size(); i++) {
+ if (_receivers[i].receiver == receiver) {
+ _receivers[i].mask = (_receivers[i].mask & ~mask) | (flags & mask);
receiver->newNotification(this);
return;
}
@@ -66,11 +66,11 @@ void Notification::notifyMe(NotificationReceiver *receiver, NotificationFlags fl
}
void Notification::cancelNotification(NotificationReceiver *receiver) {
- for (ReceiverIterator it = _receivers.begin(); it != _receivers.end();) {
- if (it->receiver == receiver)
- it = _receivers.erase(it);
- else
- it++;
+ for (uint i = 0; i < _receivers.size(); i++) {
+ if (_receivers[i].receiver == receiver) {
+ _receivers.remove_at(i);
+ i--;
+ }
}
}
@@ -82,9 +82,9 @@ void Notification::checkReceivers() {
NotificationFlags currentFlags = _currentFlags;
_currentFlags = kNoNotificationFlags;
- for (ReceiverIterator it = _receivers.begin(); it != _receivers.end(); it++)
- if (it->mask & currentFlags)
- it->receiver->receiveNotification(this, currentFlags);
+ for (uint i = 0; i < _receivers.size(); i++)
+ if (_receivers[i].mask & currentFlags)
+ _receivers[i].receiver->receiveNotification(this, currentFlags);
}
// Receiver entries are equal if their receivers are equal.
diff --git a/engines/pegasus/notification.h b/engines/pegasus/notification.h
index 142bf8c06d..e795a4b375 100644
--- a/engines/pegasus/notification.h
+++ b/engines/pegasus/notification.h
@@ -26,6 +26,7 @@
#ifndef PEGASUS_NOTIFICATION_H
#define PEGASUS_NOTIFICATION_H
+#include "common/array.h"
#include "common/list.h"
#include "pegasus/types.h"
@@ -44,7 +45,7 @@ struct ReceiverEntry {
int operator==(const ReceiverEntry &entry1, const ReceiverEntry &entry2);
int operator!=(const ReceiverEntry &entry1, const ReceiverEntry &entry2);
-typedef Common::List<ReceiverEntry> ReceiverList;
+typedef Common::Array<ReceiverEntry> ReceiverList;
/*
A notification can have 32 flags associated with it, which can be user-defined.