mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-22 15:51:16 +00:00
Initial implementation of RemovePresenter/Find/Detach
This commit is contained in:
parent
de8cb523fa
commit
9e8f8b0f60
@ -58,11 +58,72 @@ class MxList : protected MxListParent<T>
|
|||||||
virtual ~MxList();
|
virtual ~MxList();
|
||||||
|
|
||||||
void Append(T*);
|
void Append(T*);
|
||||||
|
|
||||||
|
friend class MxListCursor<T>;
|
||||||
protected:
|
protected:
|
||||||
MxListEntry<T> *m_first; // +0x10
|
MxListEntry<T> *m_first; // +0x10
|
||||||
MxListEntry<T> *m_last; // +0x14
|
MxListEntry<T> *m_last; // +0x14
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// VTABLE 0x100d6488
|
||||||
|
template <class T>
|
||||||
|
class MxListCursor : public MxCore
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MxListCursor(MxList<T> *p_list) {
|
||||||
|
m_list = p_list;
|
||||||
|
m_match = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
MxBool Find(T *p_obj) {
|
||||||
|
for (m_match = m_list->m_first;
|
||||||
|
m_match && m_list->Compare(m_match->m_obj, p_obj);
|
||||||
|
m_match = m_match->m_next);
|
||||||
|
|
||||||
|
return m_match != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detach() {
|
||||||
|
MxListEntry<T> *m_prev = m_match->m_prev;
|
||||||
|
MxListEntry<T> *m_next = m_match->m_next;
|
||||||
|
|
||||||
|
if (m_prev)
|
||||||
|
m_prev->m_next = m_next;
|
||||||
|
else
|
||||||
|
m_list->m_first = m_next;
|
||||||
|
|
||||||
|
if (m_next)
|
||||||
|
m_next->m_prev = m_prev;
|
||||||
|
else
|
||||||
|
m_list->m_last = m_prev;
|
||||||
|
|
||||||
|
delete m_match;
|
||||||
|
m_list->m_count--;
|
||||||
|
m_match = NULL;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
MxList<T> *m_list;
|
||||||
|
MxListEntry<T> *m_match;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Unclear purpose
|
||||||
|
// VTABLE 0x100d6530
|
||||||
|
template <class T>
|
||||||
|
class MxListCursorChild : public MxListCursor<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MxListCursorChild(MxList<T> *p_list) : MxListCursor<T>(p_list) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Unclear purpose
|
||||||
|
// VTABLE 0x100d6470
|
||||||
|
template <class T>
|
||||||
|
class MxListCursorChildChild : public MxListCursorChild<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MxListCursorChildChild(MxList<T> *p_list) : MxListCursorChild<T>(p_list) {}
|
||||||
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
// OFFSET: LEGO1 0x1001ce20
|
// OFFSET: LEGO1 0x1001ce20
|
||||||
MxList<T>::~MxList()
|
MxList<T>::~MxList()
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
DECOMP_SIZE_ASSERT(MxMediaManager, 0x2c);
|
DECOMP_SIZE_ASSERT(MxMediaManager, 0x2c);
|
||||||
|
|
||||||
|
typedef MxListCursorChildChild<MxPresenter> MxPresenterListCursor;
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100b84c0
|
// OFFSET: LEGO1 0x100b84c0
|
||||||
MxMediaManager::MxMediaManager()
|
MxMediaManager::MxMediaManager()
|
||||||
{
|
{
|
||||||
@ -64,12 +66,14 @@ void MxMediaManager::AddPresenter(MxPresenter &p_presenter)
|
|||||||
this->m_presenters->Append(&p_presenter);
|
this->m_presenters->Append(&p_presenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100b8980 STUB
|
// OFFSET: LEGO1 0x100b8980
|
||||||
void MxMediaManager::RemovePresenter(MxPresenter &p_presenter)
|
void MxMediaManager::RemovePresenter(MxPresenter &p_presenter)
|
||||||
{
|
{
|
||||||
MxAutoLocker lock(&this->m_criticalSection);
|
MxAutoLocker lock(&this->m_criticalSection);
|
||||||
|
MxPresenterListCursor cursor(this->m_presenters);
|
||||||
|
|
||||||
// Remove element from m_presenters
|
if (cursor.Find(&p_presenter))
|
||||||
|
cursor.Detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x100b8ac0 STUB
|
// OFFSET: LEGO1 0x100b8ac0 STUB
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user