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
//
CCActionInstant::CCActionInstant()
{}
CCActionInstant::CCActionInstant() {
}
CCObject * CCActionInstant::copyWithZone(CCZone *pZone)
{
CCObject * CCActionInstant::copyWithZone(CCZone *pZone) {
CCZone *pNewZone = NULL;
CCActionInstant *pRet = NULL;
if (pZone && pZone->m_pCopyObject)
{
if (pZone && pZone->m_pCopyObject) {
pRet = (CCActionInstant*) (pZone->m_pCopyObject);
}
else
{
} else {
pRet = new CCActionInstant();
pZone = pNewZone = new CCZone(pRet);
}
@ -56,63 +52,53 @@ namespace cocos2d {
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()
{
CCFiniteTimeAction * CCActionInstant::reverse() {
return (CCFiniteTimeAction*) (copy()->autorelease());
}
//
// Show
//
CCShow* CCShow::action()
{
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()
{
CCFiniteTimeAction* CCShow::reverse() {
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);
}
else
{
} else {
pRet = new CCShow();
pZone = pNewZone = new CCZone(pRet);
}
@ -125,40 +111,32 @@ namespace cocos2d {
//
// Hide
//
CCHide * CCHide::action()
{
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()
{
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)
{
if (pZone && pZone->m_pCopyObject) {
pRet = (CCHide*) (pZone->m_pCopyObject);
}
else
{
} else {
pRet = new CCHide();
pZone = pNewZone = new CCZone(pRet);
}
@ -171,20 +149,17 @@ namespace cocos2d {
//
// ToggleVisibility
//
CCToggleVisibility * CCToggleVisibility::action()
{
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());
}
@ -192,12 +167,10 @@ namespace cocos2d {
//
// FlipX
//
CCFlipX *CCFlipX::actionWithFlipX(bool x)
{
CCFlipX *CCFlipX::actionWithFlipX(bool x) {
CCFlipX *pRet = new CCFlipX();
if (pRet && pRet->initWithFlipX(x))
{
if (pRet && pRet->initWithFlipX(x)) {
pRet->autorelease();
return pRet;
}
@ -206,34 +179,27 @@ namespace cocos2d {
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);
}
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)
{
if (pZone && pZone->m_pCopyObject) {
pRet = (CCFlipX*) (pZone->m_pCopyObject);
}
else
{
} else {
pRet = new CCFlipX();
pZone = pNewZone = new CCZone(pRet);
}
@ -247,12 +213,10 @@ namespace cocos2d {
//
// FlipY
//
CCFlipY * CCFlipY::actionWithFlipY(bool y)
{
CCFlipY * CCFlipY::actionWithFlipY(bool y) {
CCFlipY *pRet = new CCFlipY();
if (pRet &&pRet->initWithFlipY(y))
{
if (pRet && pRet->initWithFlipY(y)) {
pRet->autorelease();
return pRet;
}
@ -261,34 +225,27 @@ namespace cocos2d {
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);
}
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)
{
if (pZone && pZone->m_pCopyObject) {
pRet = (CCFlipY*) (pZone->m_pCopyObject);
}
else
{
} else {
pRet = new CCFlipY();
pZone = pNewZone = new CCZone(pRet);
}
@ -302,12 +259,10 @@ namespace cocos2d {
//
// Place
//
CCPlace* CCPlace::actionWithPosition(const CCPoint& pos)
{
CCPlace* CCPlace::actionWithPosition(const CCPoint& pos) {
CCPlace *pRet = new CCPlace();
if (pRet && pRet->initWithPosition(pos))
{
if (pRet && pRet->initWithPosition(pos)) {
pRet->autorelease();
return pRet;
}
@ -316,23 +271,18 @@ namespace cocos2d {
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)
{
if (pZone && pZone->m_pCopyObject) {
pRet = (CCPlace*) (pZone->m_pCopyObject);
}
else
{
} else {
pRet = new CCPlace();
pZone = pNewZone = new CCZone(pRet);
}
@ -343,8 +293,7 @@ namespace cocos2d {
return pRet;
}
void CCPlace::startWithTarget(CCNode *pTarget)
{
void CCPlace::startWithTarget(CCNode *pTarget) {
CCActionInstant::startWithTarget(pTarget);
m_pTarget->setPosition(m_tPosition);
}
@ -353,12 +302,11 @@ namespace cocos2d {
// 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;
@ -368,12 +316,10 @@ namespace cocos2d {
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;
}
@ -382,21 +328,17 @@ namespace cocos2d {
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();
}
@ -404,18 +346,14 @@ namespace cocos2d {
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
{
} else {
pRet = new CCCallFunc();
pZone = pNewZone = new CCZone(pRet);
}
@ -428,48 +366,41 @@ namespace cocos2d {
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)
{
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;
}
@ -478,12 +409,10 @@ namespace cocos2d {
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;
}
@ -492,10 +421,9 @@ namespace cocos2d {
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;
}
@ -503,18 +431,14 @@ namespace cocos2d {
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
{
} else {
pRet = new CCCallFuncN();
zone = pNewZone = new CCZone(pRet);
}
@ -528,12 +452,11 @@ namespace cocos2d {
//
// 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();
if (pRet && pRet->initWithTarget(pSelectorTarget, selector, d))
{
if (pRet && pRet->initWithTarget(pSelectorTarget, selector, d)) {
pRet->autorelease();
return pRet;
}
@ -542,12 +465,11 @@ namespace cocos2d {
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;
@ -557,10 +479,9 @@ namespace cocos2d {
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;
@ -569,18 +490,14 @@ namespace cocos2d {
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
{
} else {
pRet = new CCCallFuncND();
zone = pNewZone = new CCZone(pRet);
}
@ -591,54 +508,44 @@ namespace cocos2d {
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() :
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;
}
@ -647,12 +554,10 @@ namespace cocos2d {
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;
}
@ -661,10 +566,9 @@ namespace cocos2d {
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)
@ -675,18 +579,14 @@ 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
{
} else {
pRet = new CCCallFuncO();
zone = pNewZone = new CCZone(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