fix some compiling mistake

This commit is contained in:
laschweinski 2011-09-05 10:12:14 +08:00
parent 1fc09448a4
commit 717698bf65
2 changed files with 587 additions and 686 deletions

View File

@ -1,28 +1,28 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
http://www.cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCActionInstant.h"
#include "CCNode.h"
@ -30,23 +30,19 @@ THE SOFTWARE.
#include "CCScriptSupport.h"
namespace cocos2d {
//
// InstantAction
//
CCActionInstant::CCActionInstant()
{}
//
// InstantAction
//
CCActionInstant::CCActionInstant() {
}
CCObject * CCActionInstant::copyWithZone(CCZone *pZone)
{
CCObject * CCActionInstant::copyWithZone(CCZone *pZone) {
CCZone *pNewZone = NULL;
CCActionInstant *pRet = NULL;
if (pZone && pZone->m_pCopyObject)
{
pRet = (CCActionInstant*)(pZone->m_pCopyObject);
}
else
{
if (pZone && pZone->m_pCopyObject) {
pRet = (CCActionInstant*) (pZone->m_pCopyObject);
} else {
pRet = new CCActionInstant();
pZone = pNewZone = new CCZone(pRet);
}
@ -54,65 +50,55 @@ namespace cocos2d {
CCFiniteTimeAction::copyWithZone(pZone);
CC_SAFE_DELETE(pNewZone);
return pRet;
}
}
bool CCActionInstant::isDone()
{
bool CCActionInstant::isDone() {
return true;
}
}
void CCActionInstant::step(ccTime dt)
{
void CCActionInstant::step(ccTime dt) {
CC_UNUSED_PARAM(dt);
update(1);
}
}
void CCActionInstant::update(ccTime time)
{
void CCActionInstant::update(ccTime time) {
CC_UNUSED_PARAM(time);
// ignore
}
}
CCFiniteTimeAction * CCActionInstant::reverse()
{
return (CCFiniteTimeAction*)(copy()->autorelease());
}
CCFiniteTimeAction * CCActionInstant::reverse() {
return (CCFiniteTimeAction*) (copy()->autorelease());
}
//
// Show
//
CCShow* CCShow::action()
{
//
// Show
//
CCShow* CCShow::action() {
CCShow* pRet = new CCShow();
if (pRet)
{
if (pRet) {
pRet->autorelease();
}
return pRet;
}
}
void CCShow::startWithTarget(CCNode *pTarget)
{
void CCShow::startWithTarget(CCNode *pTarget) {
CCActionInstant::startWithTarget(pTarget);
pTarget->setIsVisible(true);
}
}
CCFiniteTimeAction* CCShow::reverse()
{
return (CCFiniteTimeAction*)(CCHide::action());
}
CCFiniteTimeAction* CCShow::reverse() {
return (CCFiniteTimeAction*) (CCHide::action());
}
CCObject* CCShow::copyWithZone(CCZone *pZone)
{
CCObject* CCShow::copyWithZone(CCZone *pZone) {
if (pZone && pZone->m_pCopyObject)
{
pRet = (CCShow*)(pZone->m_pCopyObject);
}
else
{
CCZone *pNewZone = NULL;
CCShow *pRet = NULL;
if (pZone && pZone->m_pCopyObject) {
pRet = (CCShow*) (pZone->m_pCopyObject);
} else {
pRet = new CCShow();
pZone = pNewZone = new CCZone(pRet);
}
@ -120,45 +106,37 @@ namespace cocos2d {
CCFiniteTimeAction::copyWithZone(pZone);
CC_SAFE_DELETE(pNewZone);
return pRet;
}
}
//
// Hide
//
CCHide * CCHide::action()
{
//
// Hide
//
CCHide * CCHide::action() {
CCHide *pRet = new CCHide();
if (pRet)
{
if (pRet) {
pRet->autorelease();
}
return pRet;
}
}
void CCHide::startWithTarget(CCNode *pTarget)
{
void CCHide::startWithTarget(CCNode *pTarget) {
CCActionInstant::startWithTarget(pTarget);
pTarget->setIsVisible(false);
}
}
CCFiniteTimeAction *CCHide::reverse()
{
return (CCFiniteTimeAction*)(CCShow::action());
}
CCFiniteTimeAction *CCHide::reverse() {
return (CCFiniteTimeAction*) (CCShow::action());
}
CCObject* CCHide::copyWithZone(CCZone *pZone)
{
CCObject* CCHide::copyWithZone(CCZone *pZone) {
CCZone *pNewZone = NULL;
CCHide *pRet = NULL;
if (pZone && pZone->m_pCopyObject)
{
pRet = (CCHide*)(pZone->m_pCopyObject);
}
else
{
if (pZone && pZone->m_pCopyObject) {
pRet = (CCHide*) (pZone->m_pCopyObject);
} else {
pRet = new CCHide();
pZone = pNewZone = new CCZone(pRet);
}
@ -166,74 +144,62 @@ namespace cocos2d {
CCFiniteTimeAction::copyWithZone(pZone);
CC_SAFE_DELETE(pNewZone);
return pRet;
}
}
//
// ToggleVisibility
//
CCToggleVisibility * CCToggleVisibility::action()
{
//
// ToggleVisibility
//
CCToggleVisibility * CCToggleVisibility::action() {
CCToggleVisibility *pRet = new CCToggleVisibility();
if (pRet)
{
if (pRet) {
pRet->autorelease();
}
return pRet;
}
}
void CCToggleVisibility::startWithTarget(CCNode *pTarget)
{
void CCToggleVisibility::startWithTarget(CCNode *pTarget) {
CCActionInstant::startWithTarget(pTarget);
pTarget->setIsVisible(! pTarget->getIsVisible());
}
pTarget->setIsVisible(!pTarget->getIsVisible());
}
//
// FlipX
//
CCFlipX *CCFlipX::actionWithFlipX(bool x)
{
//
// FlipX
//
CCFlipX *CCFlipX::actionWithFlipX(bool x) {
CCFlipX *pRet = new CCFlipX();
if (pRet && pRet->initWithFlipX(x))
{
if (pRet && pRet->initWithFlipX(x)) {
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet)
return NULL;
}
}
bool CCFlipX::initWithFlipX(bool x)
{
bool CCFlipX::initWithFlipX(bool x) {
m_bFlipX = x;
return true;
}
}
void CCFlipX::startWithTarget(CCNode *pTarget)
{
void CCFlipX::startWithTarget(CCNode *pTarget) {
CCActionInstant::startWithTarget(pTarget);
((CCSprite*)(pTarget))->setFlipX(m_bFlipX);
}
((CCSprite*) (pTarget))->setFlipX(m_bFlipX);
}
CCFiniteTimeAction* CCFlipX::reverse()
{
CCFiniteTimeAction* CCFlipX::reverse() {
return CCFlipX::actionWithFlipX(!m_bFlipX);
}
}
CCObject * CCFlipX::copyWithZone(CCZone *pZone)
{
CCObject * CCFlipX::copyWithZone(CCZone *pZone) {
CCZone *pNewZone = NULL;
CCFlipX *pRet = NULL;
if (pZone && pZone->m_pCopyObject)
{
pRet = (CCFlipX*)(pZone->m_pCopyObject);
}
else
{
if (pZone && pZone->m_pCopyObject) {
pRet = (CCFlipX*) (pZone->m_pCopyObject);
} else {
pRet = new CCFlipX();
pZone = pNewZone = new CCZone(pRet);
}
@ -242,53 +208,44 @@ namespace cocos2d {
pRet->initWithFlipX(m_bFlipX);
CC_SAFE_DELETE(pNewZone);
return pRet;
}
}
//
// FlipY
//
CCFlipY * CCFlipY::actionWithFlipY(bool y)
{
//
// FlipY
//
CCFlipY * CCFlipY::actionWithFlipY(bool y) {
CCFlipY *pRet = new CCFlipY();
if (pRet &&pRet->initWithFlipY(y))
{
if (pRet && pRet->initWithFlipY(y)) {
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}
bool CCFlipY::initWithFlipY(bool y)
{
bool CCFlipY::initWithFlipY(bool y) {
m_bFlipY = y;
return true;
}
}
void CCFlipY::startWithTarget(CCNode *pTarget)
{
void CCFlipY::startWithTarget(CCNode *pTarget) {
CCActionInstant::startWithTarget(pTarget);
((CCSprite*)(pTarget))->setFlipY(m_bFlipY);
}
((CCSprite*) (pTarget))->setFlipY(m_bFlipY);
}
CCFiniteTimeAction* CCFlipY::reverse()
{
CCFiniteTimeAction* CCFlipY::reverse() {
return CCFlipY::actionWithFlipY(!m_bFlipY);
}
}
CCObject* CCFlipY::copyWithZone(CCZone *pZone)
{
CCObject* CCFlipY::copyWithZone(CCZone *pZone) {
CCZone *pNewZone = NULL;
CCFlipY *pRet = NULL;
if (pZone && pZone->m_pCopyObject)
{
pRet = (CCFlipY*)(pZone->m_pCopyObject);
}
else
{
if (pZone && pZone->m_pCopyObject) {
pRet = (CCFlipY*) (pZone->m_pCopyObject);
} else {
pRet = new CCFlipY();
pZone = pNewZone = new CCZone(pRet);
}
@ -297,42 +254,35 @@ namespace cocos2d {
pRet->initWithFlipY(m_bFlipY);
CC_SAFE_DELETE(pNewZone);
return pRet;
}
}
//
// Place
//
CCPlace* CCPlace::actionWithPosition(const CCPoint& pos)
{
//
// Place
//
CCPlace* CCPlace::actionWithPosition(const CCPoint& pos) {
CCPlace *pRet = new CCPlace();
if (pRet && pRet->initWithPosition(pos))
{
if (pRet && pRet->initWithPosition(pos)) {
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}
bool CCPlace::initWithPosition(const CCPoint& pos)
{
bool CCPlace::initWithPosition(const CCPoint& pos) {
m_tPosition = pos;
return true;
}
}
CCObject * CCPlace::copyWithZone(CCZone *pZone)
{
CCObject * CCPlace::copyWithZone(CCZone *pZone) {
CCZone *pNewZone = NULL;
CCPlace *pRet = NULL;
if (pZone && pZone->m_pCopyObject)
{
pRet = (CCPlace*)(pZone->m_pCopyObject);
}
else
{
if (pZone && pZone->m_pCopyObject) {
pRet = (CCPlace*) (pZone->m_pCopyObject);
} else {
pRet = new CCPlace();
pZone = pNewZone = new CCZone(pRet);
}
@ -341,24 +291,22 @@ namespace cocos2d {
pRet->initWithPosition(m_tPosition);
CC_SAFE_DELETE(pNewZone);
return pRet;
}
}
void CCPlace::startWithTarget(CCNode *pTarget)
{
void CCPlace::startWithTarget(CCNode *pTarget) {
CCActionInstant::startWithTarget(pTarget);
m_pTarget->setPosition(m_tPosition);
}
}
//
// CallFunc
//
//
// CallFunc
//
CCCallFunc * CCCallFunc::actionWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFunc selector)
{
CCCallFunc * CCCallFunc::actionWithTarget(SelectorProtocol* pSelectorTarget,
SEL_CallFunc selector) {
CCCallFunc *pRet = new CCCallFunc();
if(pRet && pRet->initWithTarget(pSelectorTarget))
{
if (pRet && pRet->initWithTarget(pSelectorTarget)) {
pRet->m_pCallFunc = selector;
pRet->autorelease();
return pRet;
@ -366,56 +314,46 @@ namespace cocos2d {
CC_SAFE_DELETE(pRet);
return NULL;
}
}
CCCallFunc* CCCallFunc::actionWithScriptFuncName(const char* pszFuncName)
{
CCCallFunc* CCCallFunc::actionWithScriptFuncName(const char* pszFuncName) {
CCCallFunc *pRet = new CCCallFunc();
if(pRet && pRet->initWithScriptFuncName(pszFuncName))
{
if (pRet && pRet->initWithScriptFuncName(pszFuncName)) {
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}
bool CCCallFunc::initWithScriptFuncName(const char *pszFuncName)
{
bool CCCallFunc::initWithScriptFuncName(const char *pszFuncName) {
this->m_scriptFuncName = string(pszFuncName);
return true;
}
}
bool CCCallFunc::initWithTarget(SelectorProtocol* pSelectorTarget)
{
if (pSelectorTarget)
{
bool CCCallFunc::initWithTarget(SelectorProtocol* pSelectorTarget) {
if (pSelectorTarget) {
pSelectorTarget->selectorProtocolRetain();
}
if (m_pSelectorTarget)
{
if (m_pSelectorTarget) {
m_pSelectorTarget->selectorProtocolRelease();
}
m_pSelectorTarget = pSelectorTarget;
return true;
}
}
CCObject * CCCallFunc::copyWithZone(CCZone *pZone)
{
CCObject * CCCallFunc::copyWithZone(CCZone *pZone) {
CCZone* pNewZone = NULL;
CCCallFunc* pRet = NULL;
if(pZone && pZone->m_pCopyObject)
{
if (pZone && pZone->m_pCopyObject) {
//in case of being called at sub class
pRet = (CCCallFunc*)(pZone->m_pCopyObject);
}
else
{
pRet = (CCCallFunc*) (pZone->m_pCopyObject);
} else {
pRet = new CCCallFunc();
pZone = pNewZone = new CCZone(pRet);
}
@ -426,95 +364,81 @@ namespace cocos2d {
pRet->m_scriptFuncName = m_scriptFuncName;
CC_SAFE_DELETE(pNewZone);
return pRet;
}
}
void CCCallFunc::startWithTarget(CCNode *pTarget)
{
void CCCallFunc::startWithTarget(CCNode *pTarget) {
CCActionInstant::startWithTarget(pTarget);
this->execute();
}
}
void CCCallFunc::execute()
{
if(m_pCallFunc)
{
void CCCallFunc::execute() {
if (m_pCallFunc) {
(m_pSelectorTarget->*m_pCallFunc)();
}
if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine())
{
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFunc(m_scriptFuncName.c_str());
}
if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()) {
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFunc(
m_scriptFuncName.c_str());
}
}
//
// CallFuncN
//
void CCCallFuncN::execute()
{
if(m_pCallFuncN)
{
//
// CallFuncN
//
void CCCallFuncN::execute() {
if (m_pCallFuncN) {
(m_pSelectorTarget->*m_pCallFuncN)(m_pTarget);
}
if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine())
{
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFuncN(m_scriptFuncName.c_str(),
m_pTarget);
}
if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()) {
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFuncN(
m_scriptFuncName.c_str(), m_pTarget);
}
}
CCCallFuncN * CCCallFuncN::actionWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncN selector)
{
CCCallFuncN * CCCallFuncN::actionWithTarget(SelectorProtocol* pSelectorTarget,
SEL_CallFuncN selector) {
CCCallFuncN *pRet = new CCCallFuncN();
if(pRet && pRet->initWithTarget(pSelectorTarget, selector))
{
if (pRet && pRet->initWithTarget(pSelectorTarget, selector)) {
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}
CCCallFuncN* CCCallFuncN::actionWithScriptFuncName(const char *pszFuncName)
{
CCCallFuncN* CCCallFuncN::actionWithScriptFuncName(const char *pszFuncName) {
CCCallFuncN *pRet = new CCCallFuncN();
if(pRet && pRet->initWithScriptFuncName(pszFuncName))
{
if (pRet && pRet->initWithScriptFuncName(pszFuncName)) {
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}
bool CCCallFuncN::initWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncN selector)
{
if(CCCallFunc::initWithTarget(pSelectorTarget))
{
bool CCCallFuncN::initWithTarget(SelectorProtocol* pSelectorTarget,
SEL_CallFuncN selector) {
if (CCCallFunc::initWithTarget(pSelectorTarget)) {
m_pCallFuncN = selector;
return true;
}
return false;
}
}
CCObject * CCCallFuncN::copyWithZone(CCZone* zone)
{
CCObject * CCCallFuncN::copyWithZone(CCZone* zone) {
CCZone* pNewZone = NULL;
CCCallFuncN* pRet = NULL;
if(zone && zone->m_pCopyObject)
{
if (zone && zone->m_pCopyObject) {
//in case of being called at sub class
pRet = (CCCallFuncN*)(zone->m_pCopyObject);
}
else
{
pRet = (CCCallFuncN*) (zone->m_pCopyObject);
} else {
pRet = new CCCallFuncN();
zone = pNewZone = new CCZone(pRet);
}
@ -523,31 +447,29 @@ namespace cocos2d {
pRet->initWithTarget(m_pSelectorTarget, m_pCallFuncN);
CC_SAFE_DELETE(pNewZone);
return pRet;
}
}
//
// CallFuncND
//
CCCallFuncND * CCCallFuncND::actionWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncND selector, void* d)
{
//
// CallFuncND
//
CCCallFuncND * CCCallFuncND::actionWithTarget(SelectorProtocol* pSelectorTarget,
SEL_CallFuncND selector, void* d) {
CCCallFuncND* pRet = new CCCallFuncND();
if (pRet && pRet->initWithTarget(pSelectorTarget, selector, d))
{
if (pRet && pRet->initWithTarget(pSelectorTarget, selector, d)) {
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}
CCCallFuncND* CCCallFuncND::actionWithScriptFuncName(const char* pszFuncName, void *d)
{
CCCallFuncND* CCCallFuncND::actionWithScriptFuncName(const char* pszFuncName,
void *d) {
CCCallFuncND* pRet = new CCCallFuncND();
if (pRet && pRet->initWithScriptFuncName(pszFuncName))
{
if (pRet && pRet->initWithScriptFuncName(pszFuncName)) {
pRet->autorelease();
pRet->m_pData = d;
return pRet;
@ -555,32 +477,27 @@ namespace cocos2d {
CC_SAFE_DELETE(pRet);
return NULL;
}
}
bool CCCallFuncND::initWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncND selector, void* d)
{
if( CCCallFunc::initWithTarget(pSelectorTarget) )
{
bool CCCallFuncND::initWithTarget(SelectorProtocol* pSelectorTarget,
SEL_CallFuncND selector, void* d) {
if (CCCallFunc::initWithTarget(pSelectorTarget)) {
m_pData = d;
m_pCallFuncND = selector;
return true;
}
return false;
}
}
CCObject * CCCallFuncND::copyWithZone(CCZone* zone)
{
CCObject * CCCallFuncND::copyWithZone(CCZone* zone) {
CCZone* pNewZone = NULL;
CCCallFuncND* pRet = NULL;
if(zone && zone->m_pCopyObject)
{
if (zone && zone->m_pCopyObject) {
//in case of being called at sub class
pRet = (CCCallFuncND*)(zone->m_pCopyObject);
}
else
{
pRet = (CCCallFuncND*) (zone->m_pCopyObject);
} else {
pRet = new CCCallFuncND();
zone = pNewZone = new CCZone(pRet);
}
@ -589,82 +506,69 @@ namespace cocos2d {
pRet->initWithTarget(m_pSelectorTarget, m_pCallFuncND, m_pData);
CC_SAFE_DELETE(pNewZone);
return pRet;
}
}
void CCCallFuncND::execute()
{
if(m_pCallFuncND)
{
void CCCallFuncND::execute() {
if (m_pCallFuncND) {
(m_pSelectorTarget->*m_pCallFuncND)(m_pTarget, m_pData);
}
if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine())
{
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFuncND(m_scriptFuncName.c_str(),
m_pTarget,
m_pData);
}
if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()) {
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFuncND(
m_scriptFuncName.c_str(), m_pTarget, m_pData);
}
}
//
// CCCallFuncO
//
CCCallFuncO::CCCallFuncO()
: m_pObject(NULL)
{
}
//
// CCCallFuncO
//
CCCallFuncO::CCCallFuncO() :
m_pObject(NULL) {
}
CCCallFuncO::~CCCallFuncO()
{
CCCallFuncO::~CCCallFuncO() {
CC_SAFE_RELEASE(m_pObject);
}
}
void CCCallFuncO::execute()
{
if(m_pCallFuncO)
{
void CCCallFuncO::execute() {
if (m_pCallFuncO) {
(m_pSelectorTarget->*m_pCallFuncO)(m_pObject);
}
if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine())
{
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFunc0(m_scriptFuncName.c_str(),
m_pObject);
}
if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()) {
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFunc0(
m_scriptFuncName.c_str(), m_pObject);
}
}
CCCallFuncO * CCCallFuncO::actionWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncO selector, CCObject* pObject)
{
CCCallFuncO * CCCallFuncO::actionWithTarget(SelectorProtocol* pSelectorTarget,
SEL_CallFuncO selector, CCObject* pObject) {
CCCallFuncO *pRet = new CCCallFuncO();
if(pRet && pRet->initWithTarget(pSelectorTarget, selector, pObject))
{
if (pRet && pRet->initWithTarget(pSelectorTarget, selector, pObject)) {
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}
CCCallFuncO* CCCallFuncO::actionWithScriptFuncName(const char *pszFuncName)
{
CCCallFuncO* CCCallFuncO::actionWithScriptFuncName(const char *pszFuncName) {
CCCallFuncO *pRet = new CCCallFuncO();
if(pRet && pRet->initWithScriptFuncName(pszFuncName))
{
if (pRet && pRet->initWithScriptFuncName(pszFuncName)) {
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
}
bool CCCallFuncO::initWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncO selector, CCObject* pObject)
{
if( CCCallFunc::initWithTarget(pSelectorTarget) )
{
bool CCCallFuncO::initWithTarget(SelectorProtocol* pSelectorTarget,
SEL_CallFuncO selector, CCObject* pObject) {
if (CCCallFunc::initWithTarget(pSelectorTarget)) {
m_pObject = pObject;
CC_SAFE_RETAIN(m_pObject)
@ -673,20 +577,16 @@ namespace cocos2d {
}
return false;
}
}
CCObject * CCCallFuncO::copyWithZone(CCZone* zone)
{
CCObject * CCCallFuncO::copyWithZone(CCZone* zone) {
CCZone* pNewZone = NULL;
CCCallFuncO* pRet = NULL;
if(zone && zone->m_pCopyObject)
{
if (zone && zone->m_pCopyObject) {
//in case of being called at sub class
pRet = (CCCallFuncO*)(zone->m_pCopyObject);
}
else
{
pRet = (CCCallFuncO*) (zone->m_pCopyObject);
} else {
pRet = new CCCallFuncO();
zone = pNewZone = new CCZone(pRet);
}
@ -695,5 +595,5 @@ namespace cocos2d {
pRet->initWithTarget(m_pSelectorTarget, m_pCallFuncO, m_pObject);
CC_SAFE_DELETE(pNewZone);
return pRet;
}
}
}

View File

@ -22,6 +22,7 @@ public:
void removeDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);};
void addDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);};
void setDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);}
};
}//namespace cocos2d