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

@ -33,20 +33,16 @@ namespace cocos2d {
// //
// InstantAction // InstantAction
// //
CCActionInstant::CCActionInstant() CCActionInstant::CCActionInstant() {
{} }
CCObject * CCActionInstant::copyWithZone(CCZone *pZone) CCObject * CCActionInstant::copyWithZone(CCZone *pZone) {
{
CCZone *pNewZone = NULL; CCZone *pNewZone = NULL;
CCActionInstant *pRet = NULL; CCActionInstant *pRet = NULL;
if (pZone && pZone->m_pCopyObject) if (pZone && pZone->m_pCopyObject) {
{
pRet = (CCActionInstant*) (pZone->m_pCopyObject); pRet = (CCActionInstant*) (pZone->m_pCopyObject);
} } else {
else
{
pRet = new CCActionInstant(); pRet = new CCActionInstant();
pZone = pNewZone = new CCZone(pRet); pZone = pNewZone = new CCZone(pRet);
} }
@ -56,63 +52,53 @@ namespace cocos2d {
return pRet; return pRet;
} }
bool CCActionInstant::isDone() bool CCActionInstant::isDone() {
{
return true; return true;
} }
void CCActionInstant::step(ccTime dt) void CCActionInstant::step(ccTime dt) {
{
CC_UNUSED_PARAM(dt); CC_UNUSED_PARAM(dt);
update(1); update(1);
} }
void CCActionInstant::update(ccTime time) void CCActionInstant::update(ccTime time) {
{
CC_UNUSED_PARAM(time); CC_UNUSED_PARAM(time);
// ignore // ignore
} }
CCFiniteTimeAction * CCActionInstant::reverse() CCFiniteTimeAction * CCActionInstant::reverse() {
{
return (CCFiniteTimeAction*) (copy()->autorelease()); return (CCFiniteTimeAction*) (copy()->autorelease());
} }
// //
// Show // Show
// //
CCShow* CCShow::action() CCShow* CCShow::action() {
{
CCShow* pRet = new CCShow(); CCShow* pRet = new CCShow();
if (pRet) if (pRet) {
{
pRet->autorelease(); pRet->autorelease();
} }
return pRet; return pRet;
} }
void CCShow::startWithTarget(CCNode *pTarget) void CCShow::startWithTarget(CCNode *pTarget) {
{
CCActionInstant::startWithTarget(pTarget); CCActionInstant::startWithTarget(pTarget);
pTarget->setIsVisible(true); pTarget->setIsVisible(true);
} }
CCFiniteTimeAction* CCShow::reverse() CCFiniteTimeAction* CCShow::reverse() {
{
return (CCFiniteTimeAction*) (CCHide::action()); return (CCFiniteTimeAction*) (CCHide::action());
} }
CCObject* CCShow::copyWithZone(CCZone *pZone) CCObject* CCShow::copyWithZone(CCZone *pZone) {
{
if (pZone && pZone->m_pCopyObject) CCZone *pNewZone = NULL;
{ CCShow *pRet = NULL;
if (pZone && pZone->m_pCopyObject) {
pRet = (CCShow*) (pZone->m_pCopyObject); pRet = (CCShow*) (pZone->m_pCopyObject);
} } else {
else
{
pRet = new CCShow(); pRet = new CCShow();
pZone = pNewZone = new CCZone(pRet); pZone = pNewZone = new CCZone(pRet);
} }
@ -125,40 +111,32 @@ namespace cocos2d {
// //
// Hide // Hide
// //
CCHide * CCHide::action() CCHide * CCHide::action() {
{
CCHide *pRet = new CCHide(); CCHide *pRet = new CCHide();
if (pRet) if (pRet) {
{
pRet->autorelease(); pRet->autorelease();
} }
return pRet; return pRet;
} }
void CCHide::startWithTarget(CCNode *pTarget) void CCHide::startWithTarget(CCNode *pTarget) {
{
CCActionInstant::startWithTarget(pTarget); CCActionInstant::startWithTarget(pTarget);
pTarget->setIsVisible(false); pTarget->setIsVisible(false);
} }
CCFiniteTimeAction *CCHide::reverse() CCFiniteTimeAction *CCHide::reverse() {
{
return (CCFiniteTimeAction*) (CCShow::action()); return (CCFiniteTimeAction*) (CCShow::action());
} }
CCObject* CCHide::copyWithZone(CCZone *pZone) CCObject* CCHide::copyWithZone(CCZone *pZone) {
{
CCZone *pNewZone = NULL; CCZone *pNewZone = NULL;
CCHide *pRet = NULL; CCHide *pRet = NULL;
if (pZone && pZone->m_pCopyObject) if (pZone && pZone->m_pCopyObject) {
{
pRet = (CCHide*) (pZone->m_pCopyObject); pRet = (CCHide*) (pZone->m_pCopyObject);
} } else {
else
{
pRet = new CCHide(); pRet = new CCHide();
pZone = pNewZone = new CCZone(pRet); pZone = pNewZone = new CCZone(pRet);
} }
@ -171,20 +149,17 @@ namespace cocos2d {
// //
// ToggleVisibility // ToggleVisibility
// //
CCToggleVisibility * CCToggleVisibility::action() CCToggleVisibility * CCToggleVisibility::action() {
{
CCToggleVisibility *pRet = new CCToggleVisibility(); CCToggleVisibility *pRet = new CCToggleVisibility();
if (pRet) if (pRet) {
{
pRet->autorelease(); pRet->autorelease();
} }
return pRet; return pRet;
} }
void CCToggleVisibility::startWithTarget(CCNode *pTarget) void CCToggleVisibility::startWithTarget(CCNode *pTarget) {
{
CCActionInstant::startWithTarget(pTarget); CCActionInstant::startWithTarget(pTarget);
pTarget->setIsVisible(!pTarget->getIsVisible()); pTarget->setIsVisible(!pTarget->getIsVisible());
} }
@ -192,12 +167,10 @@ namespace cocos2d {
// //
// FlipX // FlipX
// //
CCFlipX *CCFlipX::actionWithFlipX(bool x) CCFlipX *CCFlipX::actionWithFlipX(bool x) {
{
CCFlipX *pRet = new CCFlipX(); CCFlipX *pRet = new CCFlipX();
if (pRet && pRet->initWithFlipX(x)) if (pRet && pRet->initWithFlipX(x)) {
{
pRet->autorelease(); pRet->autorelease();
return pRet; return pRet;
} }
@ -206,34 +179,27 @@ namespace cocos2d {
return NULL; return NULL;
} }
bool CCFlipX::initWithFlipX(bool x) bool CCFlipX::initWithFlipX(bool x) {
{
m_bFlipX = x; m_bFlipX = x;
return true; return true;
} }
void CCFlipX::startWithTarget(CCNode *pTarget) void CCFlipX::startWithTarget(CCNode *pTarget) {
{
CCActionInstant::startWithTarget(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); return CCFlipX::actionWithFlipX(!m_bFlipX);
} }
CCObject * CCFlipX::copyWithZone(CCZone *pZone) CCObject * CCFlipX::copyWithZone(CCZone *pZone) {
{
CCZone *pNewZone = NULL; CCZone *pNewZone = NULL;
CCFlipX *pRet = NULL; CCFlipX *pRet = NULL;
if (pZone && pZone->m_pCopyObject) if (pZone && pZone->m_pCopyObject) {
{
pRet = (CCFlipX*) (pZone->m_pCopyObject); pRet = (CCFlipX*) (pZone->m_pCopyObject);
} } else {
else
{
pRet = new CCFlipX(); pRet = new CCFlipX();
pZone = pNewZone = new CCZone(pRet); pZone = pNewZone = new CCZone(pRet);
} }
@ -247,12 +213,10 @@ namespace cocos2d {
// //
// FlipY // FlipY
// //
CCFlipY * CCFlipY::actionWithFlipY(bool y) CCFlipY * CCFlipY::actionWithFlipY(bool y) {
{
CCFlipY *pRet = new CCFlipY(); CCFlipY *pRet = new CCFlipY();
if (pRet &&pRet->initWithFlipY(y)) if (pRet && pRet->initWithFlipY(y)) {
{
pRet->autorelease(); pRet->autorelease();
return pRet; return pRet;
} }
@ -261,34 +225,27 @@ namespace cocos2d {
return NULL; return NULL;
} }
bool CCFlipY::initWithFlipY(bool y) bool CCFlipY::initWithFlipY(bool y) {
{
m_bFlipY = y; m_bFlipY = y;
return true; return true;
} }
void CCFlipY::startWithTarget(CCNode *pTarget) void CCFlipY::startWithTarget(CCNode *pTarget) {
{
CCActionInstant::startWithTarget(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); return CCFlipY::actionWithFlipY(!m_bFlipY);
} }
CCObject* CCFlipY::copyWithZone(CCZone *pZone) CCObject* CCFlipY::copyWithZone(CCZone *pZone) {
{
CCZone *pNewZone = NULL; CCZone *pNewZone = NULL;
CCFlipY *pRet = NULL; CCFlipY *pRet = NULL;
if (pZone && pZone->m_pCopyObject) if (pZone && pZone->m_pCopyObject) {
{
pRet = (CCFlipY*) (pZone->m_pCopyObject); pRet = (CCFlipY*) (pZone->m_pCopyObject);
} } else {
else
{
pRet = new CCFlipY(); pRet = new CCFlipY();
pZone = pNewZone = new CCZone(pRet); pZone = pNewZone = new CCZone(pRet);
} }
@ -302,12 +259,10 @@ namespace cocos2d {
// //
// Place // Place
// //
CCPlace* CCPlace::actionWithPosition(const CCPoint& pos) CCPlace* CCPlace::actionWithPosition(const CCPoint& pos) {
{
CCPlace *pRet = new CCPlace(); CCPlace *pRet = new CCPlace();
if (pRet && pRet->initWithPosition(pos)) if (pRet && pRet->initWithPosition(pos)) {
{
pRet->autorelease(); pRet->autorelease();
return pRet; return pRet;
} }
@ -316,23 +271,18 @@ namespace cocos2d {
return NULL; return NULL;
} }
bool CCPlace::initWithPosition(const CCPoint& pos) bool CCPlace::initWithPosition(const CCPoint& pos) {
{
m_tPosition = pos; m_tPosition = pos;
return true; return true;
} }
CCObject * CCPlace::copyWithZone(CCZone *pZone) CCObject * CCPlace::copyWithZone(CCZone *pZone) {
{
CCZone *pNewZone = NULL; CCZone *pNewZone = NULL;
CCPlace *pRet = NULL; CCPlace *pRet = NULL;
if (pZone && pZone->m_pCopyObject) if (pZone && pZone->m_pCopyObject) {
{
pRet = (CCPlace*) (pZone->m_pCopyObject); pRet = (CCPlace*) (pZone->m_pCopyObject);
} } else {
else
{
pRet = new CCPlace(); pRet = new CCPlace();
pZone = pNewZone = new CCZone(pRet); pZone = pNewZone = new CCZone(pRet);
} }
@ -343,8 +293,7 @@ namespace cocos2d {
return pRet; return pRet;
} }
void CCPlace::startWithTarget(CCNode *pTarget) void CCPlace::startWithTarget(CCNode *pTarget) {
{
CCActionInstant::startWithTarget(pTarget); CCActionInstant::startWithTarget(pTarget);
m_pTarget->setPosition(m_tPosition); m_pTarget->setPosition(m_tPosition);
} }
@ -353,12 +302,11 @@ namespace cocos2d {
// CallFunc // CallFunc
// //
CCCallFunc * CCCallFunc::actionWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFunc selector) CCCallFunc * CCCallFunc::actionWithTarget(SelectorProtocol* pSelectorTarget,
{ SEL_CallFunc selector) {
CCCallFunc *pRet = new CCCallFunc(); CCCallFunc *pRet = new CCCallFunc();
if(pRet && pRet->initWithTarget(pSelectorTarget)) if (pRet && pRet->initWithTarget(pSelectorTarget)) {
{
pRet->m_pCallFunc = selector; pRet->m_pCallFunc = selector;
pRet->autorelease(); pRet->autorelease();
return pRet; return pRet;
@ -368,12 +316,10 @@ namespace cocos2d {
return NULL; return NULL;
} }
CCCallFunc* CCCallFunc::actionWithScriptFuncName(const char* pszFuncName) CCCallFunc* CCCallFunc::actionWithScriptFuncName(const char* pszFuncName) {
{
CCCallFunc *pRet = new CCCallFunc(); CCCallFunc *pRet = new CCCallFunc();
if(pRet && pRet->initWithScriptFuncName(pszFuncName)) if (pRet && pRet->initWithScriptFuncName(pszFuncName)) {
{
pRet->autorelease(); pRet->autorelease();
return pRet; return pRet;
} }
@ -382,21 +328,17 @@ namespace cocos2d {
return NULL; return NULL;
} }
bool CCCallFunc::initWithScriptFuncName(const char *pszFuncName) bool CCCallFunc::initWithScriptFuncName(const char *pszFuncName) {
{
this->m_scriptFuncName = string(pszFuncName); this->m_scriptFuncName = string(pszFuncName);
return true; return true;
} }
bool CCCallFunc::initWithTarget(SelectorProtocol* pSelectorTarget) bool CCCallFunc::initWithTarget(SelectorProtocol* pSelectorTarget) {
{ if (pSelectorTarget) {
if (pSelectorTarget)
{
pSelectorTarget->selectorProtocolRetain(); pSelectorTarget->selectorProtocolRetain();
} }
if (m_pSelectorTarget) if (m_pSelectorTarget) {
{
m_pSelectorTarget->selectorProtocolRelease(); m_pSelectorTarget->selectorProtocolRelease();
} }
@ -404,18 +346,14 @@ namespace cocos2d {
return true; return true;
} }
CCObject * CCCallFunc::copyWithZone(CCZone *pZone) CCObject * CCCallFunc::copyWithZone(CCZone *pZone) {
{
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCCallFunc* pRet = NULL; CCCallFunc* pRet = NULL;
if(pZone && pZone->m_pCopyObject) if (pZone && pZone->m_pCopyObject) {
{
//in case of being called at sub class //in case of being called at sub class
pRet = (CCCallFunc*) (pZone->m_pCopyObject); pRet = (CCCallFunc*) (pZone->m_pCopyObject);
} } else {
else
{
pRet = new CCCallFunc(); pRet = new CCCallFunc();
pZone = pNewZone = new CCZone(pRet); pZone = pNewZone = new CCZone(pRet);
} }
@ -428,48 +366,41 @@ namespace cocos2d {
return pRet; return pRet;
} }
void CCCallFunc::startWithTarget(CCNode *pTarget) void CCCallFunc::startWithTarget(CCNode *pTarget) {
{
CCActionInstant::startWithTarget(pTarget); CCActionInstant::startWithTarget(pTarget);
this->execute(); this->execute();
} }
void CCCallFunc::execute() void CCCallFunc::execute() {
{ if (m_pCallFunc) {
if(m_pCallFunc)
{
(m_pSelectorTarget->*m_pCallFunc)(); (m_pSelectorTarget->*m_pCallFunc)();
} }
if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()) if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()) {
{ CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFunc(
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFunc(m_scriptFuncName.c_str()); m_scriptFuncName.c_str());
} }
} }
// //
// CallFuncN // CallFuncN
// //
void CCCallFuncN::execute() void CCCallFuncN::execute() {
{ if (m_pCallFuncN) {
if(m_pCallFuncN)
{
(m_pSelectorTarget->*m_pCallFuncN)(m_pTarget); (m_pSelectorTarget->*m_pCallFuncN)(m_pTarget);
} }
if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()) if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()) {
{ CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFuncN(
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFuncN(m_scriptFuncName.c_str(), m_scriptFuncName.c_str(), m_pTarget);
m_pTarget);
} }
} }
CCCallFuncN * CCCallFuncN::actionWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncN selector) CCCallFuncN * CCCallFuncN::actionWithTarget(SelectorProtocol* pSelectorTarget,
{ SEL_CallFuncN selector) {
CCCallFuncN *pRet = new CCCallFuncN(); CCCallFuncN *pRet = new CCCallFuncN();
if(pRet && pRet->initWithTarget(pSelectorTarget, selector)) if (pRet && pRet->initWithTarget(pSelectorTarget, selector)) {
{
pRet->autorelease(); pRet->autorelease();
return pRet; return pRet;
} }
@ -478,12 +409,10 @@ namespace cocos2d {
return NULL; return NULL;
} }
CCCallFuncN* CCCallFuncN::actionWithScriptFuncName(const char *pszFuncName) CCCallFuncN* CCCallFuncN::actionWithScriptFuncName(const char *pszFuncName) {
{
CCCallFuncN *pRet = new CCCallFuncN(); CCCallFuncN *pRet = new CCCallFuncN();
if(pRet && pRet->initWithScriptFuncName(pszFuncName)) if (pRet && pRet->initWithScriptFuncName(pszFuncName)) {
{
pRet->autorelease(); pRet->autorelease();
return pRet; return pRet;
} }
@ -492,10 +421,9 @@ namespace cocos2d {
return NULL; return NULL;
} }
bool CCCallFuncN::initWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncN selector) bool CCCallFuncN::initWithTarget(SelectorProtocol* pSelectorTarget,
{ SEL_CallFuncN selector) {
if(CCCallFunc::initWithTarget(pSelectorTarget)) if (CCCallFunc::initWithTarget(pSelectorTarget)) {
{
m_pCallFuncN = selector; m_pCallFuncN = selector;
return true; return true;
} }
@ -503,18 +431,14 @@ namespace cocos2d {
return false; return false;
} }
CCObject * CCCallFuncN::copyWithZone(CCZone* zone) CCObject * CCCallFuncN::copyWithZone(CCZone* zone) {
{
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCCallFuncN* pRet = NULL; CCCallFuncN* pRet = NULL;
if(zone && zone->m_pCopyObject) if (zone && zone->m_pCopyObject) {
{
//in case of being called at sub class //in case of being called at sub class
pRet = (CCCallFuncN*) (zone->m_pCopyObject); pRet = (CCCallFuncN*) (zone->m_pCopyObject);
} } else {
else
{
pRet = new CCCallFuncN(); pRet = new CCCallFuncN();
zone = pNewZone = new CCZone(pRet); zone = pNewZone = new CCZone(pRet);
} }
@ -528,12 +452,11 @@ namespace cocos2d {
// //
// CallFuncND // CallFuncND
// //
CCCallFuncND * CCCallFuncND::actionWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncND selector, void* d) CCCallFuncND * CCCallFuncND::actionWithTarget(SelectorProtocol* pSelectorTarget,
{ SEL_CallFuncND selector, void* d) {
CCCallFuncND* pRet = new CCCallFuncND(); CCCallFuncND* pRet = new CCCallFuncND();
if (pRet && pRet->initWithTarget(pSelectorTarget, selector, d)) if (pRet && pRet->initWithTarget(pSelectorTarget, selector, d)) {
{
pRet->autorelease(); pRet->autorelease();
return pRet; return pRet;
} }
@ -542,12 +465,11 @@ namespace cocos2d {
return NULL; return NULL;
} }
CCCallFuncND* CCCallFuncND::actionWithScriptFuncName(const char* pszFuncName, void *d) CCCallFuncND* CCCallFuncND::actionWithScriptFuncName(const char* pszFuncName,
{ void *d) {
CCCallFuncND* pRet = new CCCallFuncND(); CCCallFuncND* pRet = new CCCallFuncND();
if (pRet && pRet->initWithScriptFuncName(pszFuncName)) if (pRet && pRet->initWithScriptFuncName(pszFuncName)) {
{
pRet->autorelease(); pRet->autorelease();
pRet->m_pData = d; pRet->m_pData = d;
return pRet; return pRet;
@ -557,10 +479,9 @@ namespace cocos2d {
return NULL; return NULL;
} }
bool CCCallFuncND::initWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncND selector, void* d) bool CCCallFuncND::initWithTarget(SelectorProtocol* pSelectorTarget,
{ SEL_CallFuncND selector, void* d) {
if( CCCallFunc::initWithTarget(pSelectorTarget) ) if (CCCallFunc::initWithTarget(pSelectorTarget)) {
{
m_pData = d; m_pData = d;
m_pCallFuncND = selector; m_pCallFuncND = selector;
return true; return true;
@ -569,18 +490,14 @@ namespace cocos2d {
return false; return false;
} }
CCObject * CCCallFuncND::copyWithZone(CCZone* zone) CCObject * CCCallFuncND::copyWithZone(CCZone* zone) {
{
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCCallFuncND* pRet = NULL; CCCallFuncND* pRet = NULL;
if(zone && zone->m_pCopyObject) if (zone && zone->m_pCopyObject) {
{
//in case of being called at sub class //in case of being called at sub class
pRet = (CCCallFuncND*) (zone->m_pCopyObject); pRet = (CCCallFuncND*) (zone->m_pCopyObject);
} } else {
else
{
pRet = new CCCallFuncND(); pRet = new CCCallFuncND();
zone = pNewZone = new CCZone(pRet); zone = pNewZone = new CCZone(pRet);
} }
@ -591,54 +508,44 @@ namespace cocos2d {
return pRet; return pRet;
} }
void CCCallFuncND::execute() void CCCallFuncND::execute() {
{ if (m_pCallFuncND) {
if(m_pCallFuncND)
{
(m_pSelectorTarget->*m_pCallFuncND)(m_pTarget, m_pData); (m_pSelectorTarget->*m_pCallFuncND)(m_pTarget, m_pData);
} }
if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()) if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()) {
{ CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFuncND(
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFuncND(m_scriptFuncName.c_str(), m_scriptFuncName.c_str(), m_pTarget, m_pData);
m_pTarget,
m_pData);
} }
} }
// //
// CCCallFuncO // CCCallFuncO
// //
CCCallFuncO::CCCallFuncO() CCCallFuncO::CCCallFuncO() :
: m_pObject(NULL) m_pObject(NULL) {
{
} }
CCCallFuncO::~CCCallFuncO() CCCallFuncO::~CCCallFuncO() {
{
CC_SAFE_RELEASE(m_pObject); CC_SAFE_RELEASE(m_pObject);
} }
void CCCallFuncO::execute() void CCCallFuncO::execute() {
{ if (m_pCallFuncO) {
if(m_pCallFuncO)
{
(m_pSelectorTarget->*m_pCallFuncO)(m_pObject); (m_pSelectorTarget->*m_pCallFuncO)(m_pObject);
} }
if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()) if (CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()) {
{ CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFunc0(
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFunc0(m_scriptFuncName.c_str(), m_scriptFuncName.c_str(), m_pObject);
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(); CCCallFuncO *pRet = new CCCallFuncO();
if(pRet && pRet->initWithTarget(pSelectorTarget, selector, pObject)) if (pRet && pRet->initWithTarget(pSelectorTarget, selector, pObject)) {
{
pRet->autorelease(); pRet->autorelease();
return pRet; return pRet;
} }
@ -647,12 +554,10 @@ namespace cocos2d {
return NULL; return NULL;
} }
CCCallFuncO* CCCallFuncO::actionWithScriptFuncName(const char *pszFuncName) CCCallFuncO* CCCallFuncO::actionWithScriptFuncName(const char *pszFuncName) {
{
CCCallFuncO *pRet = new CCCallFuncO(); CCCallFuncO *pRet = new CCCallFuncO();
if(pRet && pRet->initWithScriptFuncName(pszFuncName)) if (pRet && pRet->initWithScriptFuncName(pszFuncName)) {
{
pRet->autorelease(); pRet->autorelease();
return pRet; return pRet;
} }
@ -661,10 +566,9 @@ namespace cocos2d {
return NULL; return NULL;
} }
bool CCCallFuncO::initWithTarget(SelectorProtocol* pSelectorTarget, SEL_CallFuncO selector, CCObject* pObject) bool CCCallFuncO::initWithTarget(SelectorProtocol* pSelectorTarget,
{ SEL_CallFuncO selector, CCObject* pObject) {
if( CCCallFunc::initWithTarget(pSelectorTarget) ) if (CCCallFunc::initWithTarget(pSelectorTarget)) {
{
m_pObject = pObject; m_pObject = pObject;
CC_SAFE_RETAIN(m_pObject) CC_SAFE_RETAIN(m_pObject)
@ -675,18 +579,14 @@ namespace cocos2d {
return false; return false;
} }
CCObject * CCCallFuncO::copyWithZone(CCZone* zone) CCObject * CCCallFuncO::copyWithZone(CCZone* zone) {
{
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCCallFuncO* pRet = NULL; CCCallFuncO* pRet = NULL;
if(zone && zone->m_pCopyObject) if (zone && zone->m_pCopyObject) {
{
//in case of being called at sub class //in case of being called at sub class
pRet = (CCCallFuncO*) (zone->m_pCopyObject); pRet = (CCCallFuncO*) (zone->m_pCopyObject);
} } else {
else
{
pRet = new CCCallFuncO(); pRet = new CCCallFuncO();
zone = pNewZone = new CCZone(pRet); zone = pNewZone = new CCZone(pRet);
} }

View File

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