From 2a099a04d296a4dc7af3a477e4ca74c3ab77d81b Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 20 Sep 2023 09:32:57 -0400 Subject: [PATCH] Move destroy function to list class --- LEGO1/mxdsactionlist.cpp | 7 +++++++ LEGO1/mxdsactionlist.h | 7 +++++-- LEGO1/mxdsmultiaction.cpp | 9 +-------- LEGO1/mxdsmultiaction.h | 2 -- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/LEGO1/mxdsactionlist.cpp b/LEGO1/mxdsactionlist.cpp index 6265d9ee..86c75365 100644 --- a/LEGO1/mxdsactionlist.cpp +++ b/LEGO1/mxdsactionlist.cpp @@ -11,4 +11,11 @@ MxS8 MxDSActionList::Compare(MxDSAction *p_var0, MxDSAction *p_var1) if (p_var1 <= p_var0) return 1; return -1; +} + +// OFFSET: LEGO1 0x100c9cb0 +void MxDSActionList::Destroy(MxDSAction *p_action) +{ + if (p_action) + delete p_action; } \ No newline at end of file diff --git a/LEGO1/mxdsactionlist.h b/LEGO1/mxdsactionlist.h index 99824b7d..4ae6e2a6 100644 --- a/LEGO1/mxdsactionlist.h +++ b/LEGO1/mxdsactionlist.h @@ -12,12 +12,15 @@ class MxDSActionList : public MxList { public: MxDSActionList() { - unk18 = 0; + this->m_unk18 = 0; } virtual MxS8 Compare(MxDSAction *, MxDSAction *); // +0x14 - undefined unk18; + static void Destroy(MxDSAction *p_action); + +private: + undefined m_unk18; }; typedef MxListCursorChild MxDSActionListCursor; diff --git a/LEGO1/mxdsmultiaction.cpp b/LEGO1/mxdsmultiaction.cpp index 997ba92e..939b5649 100644 --- a/LEGO1/mxdsmultiaction.cpp +++ b/LEGO1/mxdsmultiaction.cpp @@ -5,14 +5,7 @@ MxDSMultiAction::MxDSMultiAction() { this->SetType(MxDSType_MultiAction); this->m_actions = new MxDSActionList; - this->m_actions->SetDestroy(MxDSMultiAction::DestroyListElement); -} - -// OFFSET: LEGO1 0x100c9cb0 -void MxDSMultiAction::DestroyListElement(MxDSAction *p_action) -{ - if (p_action) - delete p_action; + this->m_actions->SetDestroy(MxDSActionList::Destroy); } // OFFSET: LEGO1 0x100ca060 diff --git a/LEGO1/mxdsmultiaction.h b/LEGO1/mxdsmultiaction.h index 9cc4aad4..7d4312f4 100644 --- a/LEGO1/mxdsmultiaction.h +++ b/LEGO1/mxdsmultiaction.h @@ -31,8 +31,6 @@ class MxDSMultiAction : public MxDSAction private: MxU32 m_sizeOnDisk; MxDSActionList *m_actions; - - static void DestroyListElement(MxDSAction *p_action); }; #endif // MXDSMULTIACTION_H