diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index e7274f78..08c56cbd 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -42,7 +42,7 @@ struct LegoCharacter { struct LegoCharacterData; -typedef map LegoCharacterMap; +typedef map LegoCharacterMap; // SIZE 0x08 class LegoCharacterManager { @@ -93,40 +93,40 @@ class LegoCharacterManager { // _Construct // TEMPLATE: LEGO1 0x10082b90 -// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::~_Tree,map >::_Kfn,LegoCharacterComparator,allocator > +// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::~_Tree,map >::_Kfn,LegoCharacterComparator,allocator > // TEMPLATE: LEGO1 0x10082c60 -// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::iterator::_Inc +// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::iterator::_Inc // TEMPLATE: LEGO1 0x10082ca0 -// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::erase +// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::erase // TEMPLATE: LEGO1 0x100830f0 -// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::_Erase +// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::_Erase // TEMPLATE: LEGO1 0x10083130 // map >::~map > // TEMPLATE: LEGO1 0x10083840 -// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::iterator::_Dec +// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::iterator::_Dec // TEMPLATE: LEGO1 0x10083890 -// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::_Insert +// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::_Insert // TEMPLATE: LEGO1 0x10085500 -// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::insert +// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::insert // TEMPLATE: LEGO1 0x10085790 -// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::_Buynode +// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::_Buynode // TEMPLATE: LEGO1 0x100857b0 -// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::_Lrotate +// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::_Lrotate // TEMPLATE: LEGO1 0x10085810 -// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::_Rrotate +// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::_Rrotate // GLOBAL: LEGO1 0x100fc508 -// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::_Nil +// _Tree,map >::_Kfn,LegoCharacterComparator,allocator >::_Nil // clang-format on #endif // LEGOCHARACTERMANAGER_H diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 5b60129d..4dd6881c 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -173,7 +173,7 @@ MxResult LegoCharacterManager::Read(LegoStorage* p_storage) LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity) { LegoCharacter* character = NULL; - LegoCharacterMap::iterator it = m_characters->find(p_key); + LegoCharacterMap::iterator it = m_characters->find(const_cast(p_key)); if (it != m_characters->end()) { character = (*it).second; @@ -239,11 +239,46 @@ MxU32 LegoCharacterManager::GetRefCount(LegoROI* p_roi) return 0; } -// STUB: LEGO1 0x10083c30 +// FUNCTION: LEGO1 0x10083c30 // FUNCTION: BETA10 0x10074701 void LegoCharacterManager::FUN_10083c30(const char* p_name) { - // TODO + LegoCharacter* character = NULL; + LegoCharacterMap::iterator it = m_characters->find(const_cast(p_name)); + + if (it != m_characters->end()) { + character = (*it).second; + + if (character->RemoveRef() == 0) { + LegoCharacterData* data = GetData(p_name); + LegoEntity* entity = character->m_roi->GetEntity(); + + if (entity != NULL) { + entity->SetROI(NULL, FALSE, FALSE); + } + + RemoveROI(character->m_roi); + + delete[] (*it).first; + delete (*it).second; + + m_characters->erase(it); + + if (data != NULL) { + if (data->m_actor != NULL) { + data->m_actor->ClearFlag(LegoEntity::c_bit2); + delete data->m_actor; + } + else if (entity != NULL && entity->GetFlagsIsSet(LegoEntity::c_bit2)) { + entity->ClearFlag(LegoEntity::c_bit2); + delete entity; + } + + data->m_roi = NULL; + data->m_actor = NULL; + } + } + } } // FUNCTION: LEGO1 0x10083db0 @@ -266,7 +301,7 @@ void LegoCharacterManager::FUN_10083db0(LegoROI* p_roi) RemoveROI(character->m_roi); - delete[] const_cast((*it).first); + delete[] (*it).first; delete (*it).second; m_characters->erase(it); @@ -310,7 +345,7 @@ void LegoCharacterManager::FUN_10083f10(LegoROI* p_roi) RemoveROI(character->m_roi); - delete[] const_cast((*it).first); + delete[] (*it).first; delete (*it).second; m_characters->erase(it); diff --git a/LEGO1/omni/include/mxlist.h b/LEGO1/omni/include/mxlist.h index 80b0b4d5..985c48d2 100644 --- a/LEGO1/omni/include/mxlist.h +++ b/LEGO1/omni/include/mxlist.h @@ -208,7 +208,6 @@ inline MxBool MxListCursor::Find(T p_obj) { for (m_match = m_list->m_first; m_match && m_list->Compare(m_match->GetValue(), p_obj); m_match = m_match->GetNext()) { - ; } return m_match != NULL;