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,19 +87,15 @@ 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)
|
||||
if (! (*it))
|
||||
{
|
||||
removeObject(*it);
|
||||
break;
|
||||
}
|
||||
|
||||
(*it)->release();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue