@@ -80,7 +80,7 @@ std::unique_ptr<CAnimBlendHierarchy> CAnimManagerSA::GetAnimation(int ID)
8080 return nullptr ;
8181}
8282
83- std::unique_ptr<CAnimBlendHierarchy> CAnimManagerSA::GetAnimation (const char * szName, CAnimBlock* pBlock)
83+ std::unique_ptr<CAnimBlendHierarchy> CAnimManagerSA::GetAnimation (const char * szName, std::unique_ptr< CAnimBlock>& pBlock)
8484{
8585 CAnimBlendHierarchySAInterface* pInterface = nullptr ;
8686 DWORD dwFunc = FUNC_CAnimManager_GetAnimation_str_block;
@@ -100,7 +100,7 @@ std::unique_ptr<CAnimBlendHierarchy> CAnimManagerSA::GetAnimation(const char* sz
100100 return nullptr ;
101101}
102102
103- std::unique_ptr<CAnimBlendHierarchy> CAnimManagerSA::GetAnimation (unsigned int uiIndex, CAnimBlock* pBlock)
103+ std::unique_ptr<CAnimBlendHierarchy> CAnimManagerSA::GetAnimation (unsigned int uiIndex, std::unique_ptr< CAnimBlock>& pBlock)
104104{
105105 CAnimBlendHierarchySAInterface* pInterface = nullptr ;
106106 ;
@@ -121,7 +121,7 @@ std::unique_ptr<CAnimBlendHierarchy> CAnimManagerSA::GetAnimation(unsigned int u
121121 return nullptr ;
122122}
123123
124- CAnimBlock* CAnimManagerSA::GetAnimationBlock (int ID)
124+ std::unique_ptr< CAnimBlock> CAnimManagerSA::GetAnimationBlock (int ID)
125125{
126126 CAnimBlockSAInterface* pInterface = nullptr ;
127127 DWORD dwFunc = FUNC_CAnimManager_GetAnimationBlock_int;
@@ -132,10 +132,14 @@ CAnimBlock* CAnimManagerSA::GetAnimationBlock(int ID)
132132 mov pInterface, eax
133133 add esp, 0x4
134134 }
135- return GetAnimBlock (pInterface);
135+ if (pInterface)
136+ {
137+ return std::make_unique<CAnimBlockSA>(pInterface);
138+ }
139+ return nullptr ;
136140}
137141
138- CAnimBlock* CAnimManagerSA::GetAnimationBlock (const char * szName)
142+ std::unique_ptr< CAnimBlock> CAnimManagerSA::GetAnimationBlock (const char * szName)
139143{
140144 CAnimBlockSAInterface* pInterface = nullptr ;
141145 DWORD dwFunc = FUNC_CAnimManager_GetAnimationBlock_str;
@@ -146,7 +150,11 @@ CAnimBlock* CAnimManagerSA::GetAnimationBlock(const char* szName)
146150 mov pInterface, eax
147151 add esp, 0x4
148152 }
149- return GetAnimBlock (pInterface);
153+ if (pInterface)
154+ {
155+ return std::make_unique<CAnimBlockSA>(pInterface);
156+ }
157+ return nullptr ;
150158}
151159
152160int CAnimManagerSA::GetAnimationBlockIndex (const char * szName)
@@ -177,7 +185,7 @@ int CAnimManagerSA::RegisterAnimBlock(const char* szName)
177185 return iReturn;
178186}
179187
180- CAnimBlendAssocGroup* CAnimManagerSA::GetAnimBlendAssoc (AssocGroupId groupID)
188+ std::unique_ptr< CAnimBlendAssocGroup> CAnimManagerSA::GetAnimBlendAssoc (AssocGroupId groupID)
181189{
182190 CAnimBlendAssocGroupSAInterface* pInterface = nullptr ;
183191 DWORD dwFunc = FUNC_CAnimManager_GetAnimBlendAssoc;
@@ -188,7 +196,11 @@ CAnimBlendAssocGroup* CAnimManagerSA::GetAnimBlendAssoc(AssocGroupId groupID)
188196 mov pInterface, eax
189197 add esp, 0x4
190198 }
191- return GetAnimBlendAssocGroup (pInterface);
199+ if (pInterface)
200+ {
201+ return std::make_unique<CAnimBlendAssocGroupSA>(pInterface);
202+ }
203+ return nullptr ;
192204}
193205
194206AssocGroupId CAnimManagerSA::GetFirstAssocGroup (const char * szName)
@@ -773,36 +785,20 @@ std::unique_ptr<CAnimBlendAssociation> CAnimManagerSA::GetAnimBlendAssociation(C
773785 return nullptr ;
774786}
775787
776- CAnimBlendAssocGroup* CAnimManagerSA::GetAnimBlendAssocGroup (CAnimBlendAssocGroupSAInterface* pInterface)
788+ std::unique_ptr< CAnimBlendAssocGroup> CAnimManagerSA::GetAnimBlendAssocGroup (CAnimBlendAssocGroupSAInterface* pInterface)
777789{
778790 if (pInterface)
779791 {
780- AssocGroupId groupID = pInterface->groupID ;
781- if (groupID < TOTAL_ANIM_GROUPS)
782- {
783- if (!m_pAnimAssocGroups[groupID])
784- {
785- m_pAnimAssocGroups[groupID] = new CAnimBlendAssocGroupSA (pInterface);
786- }
787- return m_pAnimAssocGroups[groupID];
788- }
792+ return std::make_unique<CAnimBlendAssocGroupSA>(pInterface);
789793 }
790794 return nullptr ;
791795}
792796
793- CAnimBlock* CAnimManagerSA::GetAnimBlock (CAnimBlockSAInterface* pInterface)
797+ std::unique_ptr< CAnimBlock> CAnimManagerSA::GetAnimBlock (CAnimBlockSAInterface* pInterface)
794798{
795799 if (pInterface)
796800 {
797- unsigned int ID = pInterface->GetIndex ();
798- if (ID < MAX_ANIM_BLOCKS)
799- {
800- if (!m_pAnimBlocks[ID])
801- {
802- m_pAnimBlocks[ID] = new CAnimBlockSA (pInterface);
803- }
804- return m_pAnimBlocks[ID];
805- }
801+ return std::make_unique<CAnimBlockSA>(pInterface);
806802 }
807803 return nullptr ;
808804}
0 commit comments