mirror of https://github.com/axmolengine/axmol.git
Refactoring in CCSet
This commit is contained in:
parent
43cc383346
commit
8adb3eb6eb
|
@ -52,18 +52,7 @@ CCSet::CCSet(const CCSet &rSetObject)
|
|||
|
||||
CCSet::~CCSet(void)
|
||||
{
|
||||
// call release() of elements
|
||||
CCSetIterator iter;
|
||||
for (iter = m_pSet->begin(); iter != m_pSet->end(); ++iter)
|
||||
{
|
||||
if (! (*iter))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
(*iter)->release();
|
||||
}
|
||||
|
||||
removeAllObjects();
|
||||
CC_SAFE_DELETE(m_pSet);
|
||||
}
|
||||
|
||||
|
@ -98,20 +87,16 @@ void CCSet::removeObject(CCObject *pObject)
|
|||
|
||||
void CCSet::removeAllObjects()
|
||||
{
|
||||
if (!m_pSet || m_pSet->empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
CCSetIterator it;
|
||||
for (it = m_pSet->begin(); it != m_pSet->end(); ++it)
|
||||
{
|
||||
if (! (*it))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
CCSetIterator it;
|
||||
|
||||
for( it = m_pSet->begin(); it != m_pSet->end(); ++it)
|
||||
{
|
||||
if(*it)
|
||||
{
|
||||
removeObject(*it);
|
||||
}
|
||||
}
|
||||
(*it)->release();
|
||||
}
|
||||
}
|
||||
|
||||
bool CCSet::containsObject(CCObject *pObject)
|
||||
|
|
Loading…
Reference in New Issue