#ifndef LEGOCONTAINER_H #define LEGOCONTAINER_H #include "compat.h" #include "decomp.h" #include "legotexture.h" #include "legotypes.h" #include "mxstl/stlcompat.h" // Note: dependency on LegoOmni #include "lego/legoomni/include/legotextureinfo.h" #pragma warning(disable : 4237) struct LegoContainerInfoComparator { LegoBool operator()(const char* const& p_key0, const char* const& p_key1) const { return strcmp(p_key0, p_key1) > 0; } }; // SIZE 0x10 template class LegoContainerInfo : public map {}; // SIZE 0x18 template class LegoContainer { public: virtual ~LegoContainer() { #ifdef COMPAT_MODE typename LegoContainerInfo::iterator it; #else LegoContainerInfo::iterator it; #endif for (it = m_map.begin(); it != m_map.end(); it++) { // DECOMP: Use of const_cast here matches ~ViewLODListManager from 96 source. const char* const& key = (*it).first; delete[] const_cast(key); if (m_ownership) { delete (*it).second; } } } void Clear() { #ifdef COMPAT_MODE for (typename LegoContainerInfo::iterator it = m_map.begin(); it != m_map.end(); it++) #else for (LegoContainerInfo::iterator it = m_map.begin(); it != m_map.end(); it++) #endif { delete (*it).second; } } // FUNCTION: BETA10 0x1007bc00 inline T* Get(const char* p_name) { T* value = NULL; #ifdef COMPAT_MODE typename LegoContainerInfo::iterator it = m_map.find(p_name); #else LegoContainerInfo::iterator it = m_map.find(p_name); #endif if (it != m_map.end()) { value = (*it).second; } return value; } inline void Add(const char* p_name, T* p_value) { #ifdef COMPAT_MODE typename LegoContainerInfo::iterator it = m_map.find(p_name); #else LegoContainerInfo::iterator it = m_map.find(p_name); #endif char* name; if (it != m_map.end()) { name = const_cast((*it).first); if (m_ownership) { delete (*it).second; } } else { name = new char[strlen(p_name) + 1]; strcpy(name, p_name); } m_map[name] = p_value; } inline void SetOwnership(LegoBool p_ownership) { m_ownership = p_ownership; } protected: LegoBool m_ownership; // 0x04 LegoContainerInfo m_map; // 0x08 }; // VTABLE: LEGO1 0x100d86d4 // class LegoContainer typedef pair LegoCachedTexture; typedef list LegoCachedTextureList; // VTABLE: LEGO1 0x100d86fc // SIZE 0x24 class LegoTextureContainer : public LegoContainer { public: LegoTextureContainer() { m_ownership = TRUE; } ~LegoTextureContainer() override; LegoTextureInfo* GetCached(LegoTextureInfo* p_textureInfo); void EraseCached(LegoTextureInfo* p_textureInfo); protected: LegoCachedTextureList m_cached; // 0x18 }; // TEMPLATE: LEGO1 0x10059c50 // allocator::_Charalloc // clang-format off // TEMPLATE: LEGO1 0x10001cc0 // _Tree,map >::_Kfn,LegoContainerInfoComparator,allocator >::_Lbound // TEMPLATE: LEGO1 0x1004f740 // _Tree,map >::_Kfn,LegoContainerInfoComparator,allocator >::find // TEMPLATE: LEGO1 0x1004f800 // map >::insert // TEMPLATE: LEGO1 0x1004f960 // _Tree,map >::_Kfn,LegoContainerInfoComparator,allocator >::iterator::_Dec // TEMPLATE: LEGO1 0x1004f9b0 // _Tree,map >::_Kfn,LegoContainerInfoComparator,allocator >::_Insert // TEMPLATE: LEGO1 0x10059c70 // _Tree,map >::_Kfn,LegoContainerInfoComparator,allocator >::_Color // TEMPLATE: LEGO1 0x10059c80 // _Tree,map >::_Kfn,LegoContainerInfoComparator,allocator >::_Left // TEMPLATE: LEGO1 0x10059c90 // _Tree,map >::_Kfn,LegoContainerInfoComparator,allocator >::_Parent // TEMPLATE: LEGO1 0x10059ca0 // _Tree,map >::_Kfn,LegoContainerInfoComparator,allocator >::_Right // TEMPLATE: LEGO1 0x10059cb0 // _Tree,map >::_Kfn,LegoContainerInfoComparator,allocator >::~_Tree,map >::_Kfn,LegoContainerInfoComparator,allocator > // TEMPLATE: LEGO1 0x10059d80 // _Tree,map >::_Kfn,LegoContainerInfoComparator,allocator >::iterator::_Inc // TEMPLATE: LEGO1 0x10059dc0 // _Tree,map >::_Kfn,LegoContainerInfoComparator,allocator >::erase // TEMPLATE: LEGO1 0x1005a210 // _Tree,map >::_Kfn,LegoContainerInfoComparator,allocator >::_Erase // TEMPLATE: LEGO1 0x1005a250 // list,allocator > >::~list,allocator > > // TEMPLATE: LEGO1 0x1005a2c0 // map >::~map > // TEMPLATE: LEGO1 0x1005a310 // LegoContainer::`scalar deleting destructor' // TEMPLATE: LEGO1 0x1005a400 // LegoContainerInfo::~LegoContainerInfo // TEMPLATE: LEGO1 0x1005a450 // Map::~Map // SYNTHETIC: LEGO1 0x1005a580 // LegoTextureContainer::`scalar deleting destructor' // TEMPLATE: LEGO1 0x1005a5a0 // List >::~List > // TEMPLATE: LEGO1 0x1005b660 // LegoContainer::~LegoContainer // GLOBAL: LEGO1 0x100f0100 // _Tree,map >::_Kfn,LegoContainerInfoComparator,allocator >::_Nil // clang-format on #endif // LEGOCONTAINER_H