HASH_FIND_INT —> HASH_FIND_PTR for CCAcitonManager.cpp and CCScheduler.cpp.

This commit is contained in:
James Chen 2013-11-11 12:47:48 +08:00
parent 5a0df8d2e8
commit 55cf30b7c8
2 changed files with 25 additions and 25 deletions

View File

@ -123,7 +123,7 @@ void ActionManager::removeActionAtIndex(long index, tHashElement *element)
void ActionManager::pauseTarget(Object *target)
{
tHashElement *element = NULL;
HASH_FIND_INT(_targets, &target, element);
HASH_FIND_PTR(_targets, &target, element);
if (element)
{
element->paused = true;
@ -133,7 +133,7 @@ void ActionManager::pauseTarget(Object *target)
void ActionManager::resumeTarget(Object *target)
{
tHashElement *element = NULL;
HASH_FIND_INT(_targets, &target, element);
HASH_FIND_PTR(_targets, &target, element);
if (element)
{
element->paused = false;
@ -176,14 +176,14 @@ void ActionManager::addAction(Action *action, Node *target, bool paused)
tHashElement *element = NULL;
// we should convert it to Object*, because we save it as Object*
Object *tmp = target;
HASH_FIND_INT(_targets, &tmp, element);
HASH_FIND_PTR(_targets, &tmp, element);
if (! element)
{
element = (tHashElement*)calloc(sizeof(*element), 1);
element->paused = paused;
target->retain();
element->target = target;
HASH_ADD_INT(_targets, target, element);
HASH_ADD_PTR(_targets, target, element);
}
actionAllocWithHashElement(element);
@ -215,7 +215,7 @@ void ActionManager::removeAllActionsFromTarget(Object *target)
}
tHashElement *element = NULL;
HASH_FIND_INT(_targets, &target, element);
HASH_FIND_PTR(_targets, &target, element);
if (element)
{
if (ccArrayContainsObject(element->actions, element->currentAction) && (! element->currentActionSalvaged))
@ -250,7 +250,7 @@ void ActionManager::removeAction(Action *action)
tHashElement *element = NULL;
Object *target = action->getOriginalTarget();
HASH_FIND_INT(_targets, &target, element);
HASH_FIND_PTR(_targets, &target, element);
if (element)
{
long i = ccArrayGetIndexOfObject(element->actions, action);
@ -271,7 +271,7 @@ void ActionManager::removeActionByTag(int tag, Object *target)
CCASSERT(target != NULL, "");
tHashElement *element = NULL;
HASH_FIND_INT(_targets, &target, element);
HASH_FIND_PTR(_targets, &target, element);
if (element)
{
@ -298,7 +298,7 @@ Action* ActionManager::getActionByTag(int tag, const Object *target) const
CCASSERT(tag != Action::INVALID_TAG, "");
tHashElement *element = NULL;
HASH_FIND_INT(_targets, &target, element);
HASH_FIND_PTR(_targets, &target, element);
if (element)
{
@ -330,7 +330,7 @@ Action* ActionManager::getActionByTag(int tag, const Object *target) const
unsigned int ActionManager::getNumberOfRunningActionsInTarget(const Object *target) const
{
tHashElement *element = NULL;
HASH_FIND_INT(_targets, &target, element);
HASH_FIND_PTR(_targets, &target, element);
if (element)
{
return element->actions ? element->actions->num : 0;

View File

@ -294,7 +294,7 @@ void Scheduler::scheduleSelector(SEL_SCHEDULE selector, Object *target, float in
CCASSERT(target, "Argument target must be non-NULL");
tHashTimerEntry *element = NULL;
HASH_FIND_INT(_hashForTimers, &target, element);
HASH_FIND_PTR(_hashForTimers, &target, element);
if (! element)
{
@ -304,7 +304,7 @@ void Scheduler::scheduleSelector(SEL_SCHEDULE selector, Object *target, float in
{
target->retain();
}
HASH_ADD_INT(_hashForTimers, target, element);
HASH_ADD_PTR(_hashForTimers, target, element);
// Is this the 1st element ? Then set the pause level to all the selectors of this target
element->paused = paused;
@ -352,7 +352,7 @@ void Scheduler::unscheduleSelector(SEL_SCHEDULE selector, Object *target)
//CCASSERT(selector);
tHashTimerEntry *element = NULL;
HASH_FIND_INT(_hashForTimers, &target, element);
HASH_FIND_PTR(_hashForTimers, &target, element);
if (element)
{
@ -448,7 +448,7 @@ void Scheduler::priorityIn(tListEntry **list, Object *target, int priority, bool
target->retain();
pHashElement->list = list;
pHashElement->entry = listElement;
HASH_ADD_INT(_hashForUpdates, target, pHashElement);
HASH_ADD_PTR(_hashForUpdates, target, pHashElement);
}
void Scheduler::appendIn(_listEntry **list, Object *target, bool paused)
@ -467,14 +467,14 @@ void Scheduler::appendIn(_listEntry **list, Object *target, bool paused)
target->retain();
pHashElement->list = list;
pHashElement->entry = listElement;
HASH_ADD_INT(_hashForUpdates, target, pHashElement);
HASH_ADD_PTR(_hashForUpdates, target, pHashElement);
}
void Scheduler::scheduleUpdateForTarget(Object *target, int priority, bool paused)
{
tHashUpdateEntry *pHashElement = NULL;
HASH_FIND_INT(_hashForUpdates, &target, pHashElement);
HASH_FIND_PTR(_hashForUpdates, &target, pHashElement);
if (pHashElement)
{
#if COCOS2D_DEBUG >= 1
@ -509,7 +509,7 @@ bool Scheduler::isScheduledForTarget(SEL_SCHEDULE selector, Object *target)
CCASSERT(target, "Argument target must be non-NULL");
tHashTimerEntry *element = NULL;
HASH_FIND_INT(_hashForTimers, &target, element);
HASH_FIND_PTR(_hashForTimers, &target, element);
if (!element)
{
@ -541,7 +541,7 @@ void Scheduler::removeUpdateFromHash(struct _listEntry *entry)
{
tHashUpdateEntry *element = NULL;
HASH_FIND_INT(_hashForUpdates, &entry->target, element);
HASH_FIND_PTR(_hashForUpdates, &entry->target, element);
if (element)
{
// list entry
@ -567,7 +567,7 @@ void Scheduler::unscheduleUpdateForTarget(const Object *target)
}
tHashUpdateEntry *element = NULL;
HASH_FIND_INT(_hashForUpdates, &target, element);
HASH_FIND_PTR(_hashForUpdates, &target, element);
if (element)
{
if (_updateHashLocked)
@ -645,7 +645,7 @@ void Scheduler::unscheduleAllForTarget(Object *target)
// Custom Selectors
tHashTimerEntry *element = NULL;
HASH_FIND_INT(_hashForTimers, &target, element);
HASH_FIND_PTR(_hashForTimers, &target, element);
if (element)
{
@ -702,7 +702,7 @@ void Scheduler::resumeTarget(Object *target)
// custom selectors
tHashTimerEntry *element = NULL;
HASH_FIND_INT(_hashForTimers, &target, element);
HASH_FIND_PTR(_hashForTimers, &target, element);
if (element)
{
element->paused = false;
@ -710,7 +710,7 @@ void Scheduler::resumeTarget(Object *target)
// update selector
tHashUpdateEntry *elementUpdate = NULL;
HASH_FIND_INT(_hashForUpdates, &target, elementUpdate);
HASH_FIND_PTR(_hashForUpdates, &target, elementUpdate);
if (elementUpdate)
{
CCASSERT(elementUpdate->entry != NULL, "");
@ -724,7 +724,7 @@ void Scheduler::pauseTarget(Object *target)
// custom selectors
tHashTimerEntry *element = NULL;
HASH_FIND_INT(_hashForTimers, &target, element);
HASH_FIND_PTR(_hashForTimers, &target, element);
if (element)
{
element->paused = true;
@ -732,7 +732,7 @@ void Scheduler::pauseTarget(Object *target)
// update selector
tHashUpdateEntry *elementUpdate = NULL;
HASH_FIND_INT(_hashForUpdates, &target, elementUpdate);
HASH_FIND_PTR(_hashForUpdates, &target, elementUpdate);
if (elementUpdate)
{
CCASSERT(elementUpdate->entry != NULL, "");
@ -746,7 +746,7 @@ bool Scheduler::isTargetPaused(Object *target)
// Custom selectors
tHashTimerEntry *element = NULL;
HASH_FIND_INT(_hashForTimers, &target, element);
HASH_FIND_PTR(_hashForTimers, &target, element);
if( element )
{
return element->paused;
@ -754,7 +754,7 @@ bool Scheduler::isTargetPaused(Object *target)
// We should check update selectors if target does not have custom selectors
tHashUpdateEntry *elementUpdate = NULL;
HASH_FIND_INT(_hashForUpdates, &target, elementUpdate);
HASH_FIND_PTR(_hashForUpdates, &target, elementUpdate);
if ( elementUpdate )
{
return elementUpdate->entry->paused;