void CC3Cache::addObject( CC3Cacheable* obj ) { if ( !obj ) return; std::string objName = obj->getName(); CCAssert(!objName.empty(), "obj cannot be added to the cache because its name property is nil."); if ( getObjectNamed( objName ) ) return; CC3Cacheable* wrap = obj; _objectsByName->setObject( wrap, objName ); CC3_TRACE("[rez]Added obj[%s] to the %s cache.", objName.c_str(), _typeName.c_str()); }
void CC3Cache::addObject( CC3Cacheable* obj ) { if ( !obj ) return; std::string objName = obj->getName(); CCAssert(!objName.empty(), "obj cannot be added to the cache because its name property is nil."); CC3Cacheable* cached = getObjectNamed( objName ); if ( cached == obj ) return; if ( cached != NULL ) { CC3_WARNING( "Duplicated objects 0x%04x and 0x%04x with the same name %s found", (unsigned long long)obj, (unsigned long long)cached, objName.c_str() ); } m_objectsByName->setObject( obj, objName ); CC3_TRACE("[rez]Added obj[%s] to the %s cache.", objName.c_str(), m_typeName.c_str()); }