Exemplo n.º 1
0
void CCActionManager::removeActionByTag(int tag, CCObject *pTarget)
{
	assert(tag != kCCActionTagInvalid);
	assert(pTarget != NULL);

	tHashElement *pElement = NULL;
	HASH_FIND_INT(m_pTargets, &pTarget, pElement);

	if (pElement)
	{
		unsigned int limit = pElement->actions->num;
		for (unsigned int i = 0; i < limit; ++i)
		{
			CCAction *pAction = (CCAction*)pElement->actions->arr[i];

			if (pAction->getTag() == tag && pAction->getOriginalTarget() == pTarget)
			{
				return removeActionAtIndex(i, pElement);
			}
		}
		CCLOG("cocos2d: removeActionByTag: Action not found!");
	}
	else
	{
		CCLOG("cocos2d: removeActionByTag: Target not found!");
	}
}
Exemplo n.º 2
0
void CCActionManager::removeActionByTag(unsigned int tag, CAObject *pTarget)
{
    CCAssert((int)tag != kCCActionTagInvalid, "");
    CCAssert(pTarget != NULL, "");

    tHashElement *pElement = NULL;
    HASH_FIND_INT(m_pTargets, &pTarget, pElement);

    if (pElement)
    {
        unsigned int limit = pElement->actions->num;
        for (unsigned int i = 0; i < limit; ++i)
        {
            CCAction *pAction = (CCAction*)pElement->actions->arr[i];

            if (pAction->getTag() == (int)tag && pAction->getOriginalTarget() == pTarget)
            {
                removeActionAtIndex(i, pElement);
                break;
            }
        }
    }
}