mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 08:24:16 +00:00
MxList refactor (#290)
* MxList refactor * Reorder LegoPathControllerList::Destroy * MxPtrList custom destructor and more offsets Co-authored-by: Christian Semmler <mail@csemmler.com> * Fix member offset comments in collection classes * Fix template annotations --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef MXLIST_H
|
||||
#define MXLIST_H
|
||||
|
||||
#include "mxcollection.h"
|
||||
#include "mxcore.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
@@ -9,6 +10,12 @@ class MxList;
|
||||
template <class T>
|
||||
class MxListCursor;
|
||||
|
||||
template <class T>
|
||||
class MxPtrList : public MxList<T*> {
|
||||
public:
|
||||
MxPtrList(void (*p_destroy)(T*) = Destroy) { m_customDestructor = p_destroy; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class MxListEntry {
|
||||
public:
|
||||
@@ -40,29 +47,9 @@ private:
|
||||
MxListEntry* m_next;
|
||||
};
|
||||
|
||||
// SIZE 0x10
|
||||
template <class T>
|
||||
class MxListParent : public MxCore {
|
||||
public:
|
||||
MxListParent()
|
||||
{
|
||||
m_count = 0;
|
||||
m_customDestructor = Destroy;
|
||||
}
|
||||
|
||||
virtual ~MxListParent() {}
|
||||
virtual MxS8 Compare(T, T) { return 0; };
|
||||
|
||||
static void Destroy(T){};
|
||||
|
||||
protected:
|
||||
MxU32 m_count; // +0x8
|
||||
void (*m_customDestructor)(T); // +0xc
|
||||
};
|
||||
|
||||
// SIZE 0x18
|
||||
template <class T>
|
||||
class MxList : protected MxListParent<T> {
|
||||
class MxList : protected MxCollection<T> {
|
||||
public:
|
||||
MxList()
|
||||
{
|
||||
@@ -80,8 +67,8 @@ public:
|
||||
friend class MxListCursor<T>;
|
||||
|
||||
protected:
|
||||
MxListEntry<T>* m_first; // +0x10
|
||||
MxListEntry<T>* m_last; // +0x14
|
||||
MxListEntry<T>* m_first; // 0x10
|
||||
MxListEntry<T>* m_last; // 0x14
|
||||
|
||||
void _DeleteEntry(MxListEntry<T>* match);
|
||||
MxListEntry<T>* _InsertEntry(T, MxListEntry<T>*, MxListEntry<T>*);
|
||||
|
Reference in New Issue
Block a user