mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-26 17:46:38 -05:00
Pretty much match MxNotificationManager::FlushPending. (#91)
This commit is contained in:
parent
c7acbf559f
commit
9fa08b1017
1 changed files with 44 additions and 2 deletions
|
@ -111,10 +111,52 @@ void MxNotificationManager::Unregister(MxCore *p_listener)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100ac990 STUB
|
// OFFSET: LEGO1 0x100ac990
|
||||||
void MxNotificationManager::FlushPending(MxCore *p_listener)
|
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
|
// OFFSET: LEGO1 0x100ac6c0
|
||||||
|
|
Loading…
Reference in a new issue