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:
@@ -59,16 +59,16 @@ public:
|
||||
protected:
|
||||
void _NodeInsert(MxHashTableNode<T>*);
|
||||
|
||||
MxHashTableNode<T>** m_slots; // +0x10
|
||||
MxU32 m_numSlots; // +0x14
|
||||
MxU32 m_autoResizeRatio; // +0x18
|
||||
HashTableOpt m_resizeOption; // +0x1c
|
||||
MxHashTableNode<T>** m_slots; // 0x10
|
||||
MxU32 m_numSlots; // 0x14
|
||||
MxU32 m_autoResizeRatio; // 0x18
|
||||
HashTableOpt m_resizeOption; // 0x1c
|
||||
// FIXME: or FIXME? This qword is used as an integer or double depending
|
||||
// on the value of m_resizeOption. Hard to say whether this is how the devs
|
||||
// did it, but a simple cast in either direction doesn't match.
|
||||
union {
|
||||
MxU32 m_increaseAmount; // +0x20
|
||||
double m_increaseFactor; // +0x20
|
||||
MxU32 m_increaseAmount; // 0x20
|
||||
double m_increaseFactor; // 0x20
|
||||
};
|
||||
};
|
||||
|
||||
@@ -156,13 +156,13 @@ void MxHashTable<T>::DeleteAll()
|
||||
|
||||
while (t) {
|
||||
MxHashTableNode<T>* next = t->m_next;
|
||||
m_customDestructor(t->m_obj);
|
||||
this->m_customDestructor(t->m_obj);
|
||||
delete t;
|
||||
t = next;
|
||||
}
|
||||
}
|
||||
|
||||
m_count = 0;
|
||||
this->m_count = 0;
|
||||
memset(m_slots, 0, sizeof(MxHashTableNode<T>*) * m_numSlots);
|
||||
|
||||
delete[] m_slots;
|
||||
@@ -188,7 +188,7 @@ inline void MxHashTable<T>::Resize()
|
||||
MxHashTableNode<T>** new_table = new MxHashTableNode<T>*[m_numSlots];
|
||||
m_slots = new_table;
|
||||
memset(m_slots, 0, sizeof(MxHashTableNode<T>*) * m_numSlots);
|
||||
m_count = 0;
|
||||
this->m_count = 0;
|
||||
|
||||
for (MxS32 i = 0; i != old_size; i++) {
|
||||
MxHashTableNode<T>* t = old_table[i];
|
||||
@@ -214,13 +214,13 @@ inline void MxHashTable<T>::_NodeInsert(MxHashTableNode<T>* p_node)
|
||||
m_slots[bucket]->m_prev = p_node;
|
||||
|
||||
m_slots[bucket] = p_node;
|
||||
m_count++;
|
||||
this->m_count++;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void MxHashTable<T>::Add(T p_newobj)
|
||||
{
|
||||
if (m_resizeOption && ((m_count + 1) / m_numSlots) > m_autoResizeRatio)
|
||||
if (m_resizeOption && ((this->m_count + 1) / m_numSlots) > m_autoResizeRatio)
|
||||
MxHashTable<T>::Resize();
|
||||
|
||||
MxU32 hash = Hash(p_newobj);
|
||||
|
Reference in New Issue
Block a user