fixes some macro names

kActionInvalidTag -> Action::INVALID_TAG
kNodeTagInvalid -> Node::INVALID_TAG

and it is no longer a `#define` but an `int`

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
This commit is contained in:
Ricardo Quesada 2013-08-28 12:42:25 -07:00
parent 29e732a218
commit 85ed6d620b
7 changed files with 20 additions and 23 deletions

View File

@ -37,7 +37,7 @@ NS_CC_BEGIN
Action::Action()
:_originalTarget(NULL)
,_target(NULL)
,_tag(kActionTagInvalid)
,_tag(Action::INVALID_TAG)
{
}

View File

@ -33,11 +33,6 @@ THE SOFTWARE.
NS_CC_BEGIN
enum {
//! Default tag
kActionTagInvalid = -1,
};
/**
* @addtogroup actions
* @{
@ -49,6 +44,9 @@ enum {
class CC_DLL Action : public Object, public Clonable
{
public:
/// Default tag used for all the actions
static const int INVALID_TAG = -1;
Action(void);
virtual ~Action(void);

View File

@ -265,9 +265,9 @@ void ActionManager::removeAction(Action *pAction)
}
}
void ActionManager::removeActionByTag(unsigned int tag, Object *target)
void ActionManager::removeActionByTag(int tag, Object *target)
{
CCASSERT((int)tag != kActionTagInvalid, "");
CCASSERT(tag != Action::INVALID_TAG, "");
CCASSERT(target != NULL, "");
tHashElement *pElement = NULL;
@ -293,9 +293,9 @@ void ActionManager::removeActionByTag(unsigned int tag, Object *target)
// XXX: Passing "const O *" instead of "const O&" because HASH_FIND_IT requries the address of a pointer
// and, it is not possible to get the address of a reference
Action* ActionManager::getActionByTag(unsigned int tag, const Object *target) const
Action* ActionManager::getActionByTag(int tag, const Object *target) const
{
CCASSERT((int)tag != kActionTagInvalid, "");
CCASSERT(tag != Action::INVALID_TAG, "");
tHashElement *pElement = NULL;
HASH_FIND_INT(_targets, &target, pElement);

View File

@ -83,12 +83,12 @@ public:
void removeAction(Action *pAction);
/** Removes an action given its tag and the target */
void removeActionByTag(unsigned int tag, Object *target);
void removeActionByTag(int tag, Object *target);
/** Gets an action given its tag an a target
@return the Action the with the given tag
*/
Action* getActionByTag(unsigned int tag, const Object *target) const;
Action* getActionByTag(int tag, const Object *target) const;
/** Returns the numbers of actions that are running in a certain target.
* Composable actions are counted as 1 action. Example:

View File

@ -83,7 +83,7 @@ Node::Node(void)
, _children(NULL)
, _parent(NULL)
// "whole screen" objects. like Scenes and Layers, should set _ignoreAnchorPointForPosition to true
, _tag(kNodeTagInvalid)
, _tag(Node::INVALID_TAG)
// userData is always inited as nil
, _userData(NULL)
, _userObject(NULL)
@ -530,7 +530,7 @@ void Node::childrenAlloc(void)
Node* Node::getChildByTag(int aTag)
{
CCASSERT( aTag != kNodeTagInvalid, "Invalid tag");
CCASSERT( aTag != Node::INVALID_TAG, "Invalid tag");
if(_children && _children->count() > 0)
{
@ -625,7 +625,7 @@ void Node::removeChild(Node* child, bool cleanup /* = true */)
void Node::removeChildByTag(int tag, bool cleanup/* = true */)
{
CCASSERT( tag != kNodeTagInvalid, "Invalid tag");
CCASSERT( tag != Node::INVALID_TAG, "Invalid tag");
Node *child = this->getChildByTag(tag);
@ -976,13 +976,13 @@ void Node::stopAction(Action* action)
void Node::stopActionByTag(int tag)
{
CCASSERT( tag != kActionTagInvalid, "Invalid tag");
CCASSERT( tag != Action::INVALID_TAG, "Invalid tag");
_actionManager->removeActionByTag(tag, this);
}
Action * Node::getActionByTag(int tag)
{
CCASSERT( tag != kActionTagInvalid, "Invalid tag");
CCASSERT( tag != Action::INVALID_TAG, "Invalid tag");
return _actionManager->getActionByTag(tag, this);
}

View File

@ -58,10 +58,6 @@ class ComponentContainer;
* @{
*/
enum {
kNodeTagInvalid = -1,
};
enum {
kNodeOnEnter,
kNodeOnExit,
@ -128,6 +124,9 @@ enum {
class CC_DLL Node : public Object
{
public:
/// Default tag used for all the nodes
static const int INVALID_TAG = -1;
/// @{
/// @name Constructor, Distructor and Initializers

View File

@ -936,8 +936,8 @@ CC_DEPRECATED_ATTRIBUTE typedef TransitionScene::Orientation tOrientation;
CC_DEPRECATED_ATTRIBUTE const int kCCPrioritySystem = Scheduler::PRIORITY_SYSTEM;
CC_DEPRECATED_ATTRIBUTE const int kCCPriorityNonSystemMin = Scheduler::PRIORITY_NON_SYSTEM_MIN;
CC_DEPRECATED_ATTRIBUTE const int kCCActionTagInvalid = kActionTagInvalid;
CC_DEPRECATED_ATTRIBUTE const int kCCNodeTagInvalid = kNodeTagInvalid;
CC_DEPRECATED_ATTRIBUTE const int kCCActionTagInvalid = Action::INVALID_TAG;
CC_DEPRECATED_ATTRIBUTE const int kCCNodeTagInvalid = Node::INVALID_TAG;
CC_DEPRECATED_ATTRIBUTE const int kCCNodeOnEnter = kNodeOnEnter;
CC_DEPRECATED_ATTRIBUTE const int kCCNodeOnExit = kNodeOnExit;