Pretty much match MxNotificationManager::FlushPending. (#91)

This commit is contained in:
pewpew 2023-07-16 20:38:37 -05:00 committed by GitHub
parent c7acbf559f
commit 9fa08b1017
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -111,10 +111,52 @@ void MxNotificationManager::Unregister(MxCore *p_listener)
}
}
// OFFSET: LEGO1 0x100ac990 STUB
// OFFSET: LEGO1 0x100ac990
void MxNotificationManager::FlushPending(MxCore *p_listener)
{
// TODO
MxNotificationPtrList pending;
MxNotification *notif;
{
MxAutoLocker lock(&m_lock);
// Find all notifications from, and addressed to, p_listener.
if (m_sendList != NULL) {
MxNotificationPtrList::iterator it = m_sendList->begin();
while (it != m_sendList->end()) {
notif = *it;
if ((notif->GetTarget()->GetId() == p_listener->GetId()) ||
(notif->GetParam()->GetSender()) && (notif->GetParam()->GetSender()->GetId() == p_listener->GetId())) {
m_sendList->erase(it++);
pending.push_back(notif);
}
else {
it++;
}
}
}
MxNotificationPtrList::iterator it = m_queue->begin();
while (it != m_queue->end()) {
notif = *it;
if ((notif->GetTarget()->GetId() == p_listener->GetId()) ||
(notif->GetParam()->GetSender()) && (notif->GetParam()->GetSender()->GetId() == p_listener->GetId())) {
m_queue->erase(it++);
pending.push_back(notif);
}
else {
it++;
}
}
}
// Deliver those notifications.
while (pending.size() != 0) {
notif = pending.front();
pending.pop_front();
notif->GetTarget()->Notify(*notif->GetParam());
delete notif;
}
}
// OFFSET: LEGO1 0x100ac6c0