From 857595d644c7da7a5a31fea16fc59db2cfe83623 Mon Sep 17 00:00:00 2001 From: Ming Date: Thu, 2 Sep 2010 08:46:25 +0000 Subject: [PATCH] issue #116 --- cocos2dx/actions/CCAction.cpp | 2 +- cocos2dx/actions/CCCameraAction.cpp | 9 +++++---- cocos2dx/actions/CCIntervalAction.cpp | 4 ++-- cocos2dx/base_nodes/CCNode.cpp | 2 +- cocos2dx/cocos2dx-uphone.vcproj | 4 ++++ cocos2dx/menu_nodes/CCMenu.cpp | 9 +++++---- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/cocos2dx/actions/CCAction.cpp b/cocos2dx/actions/CCAction.cpp index 01310419e4..489279cb5e 100644 --- a/cocos2dx/actions/CCAction.cpp +++ b/cocos2dx/actions/CCAction.cpp @@ -55,7 +55,7 @@ CCAction * CCAction::action() char * CCAction::description() { char *ret = new char[100] ; - sprintf_s(ret, 100, "", m_nTag); + sprintf(ret,"", m_nTag); return ret; } NSObject* CCAction::copyWithZone(NSZone *pZone) diff --git a/cocos2dx/actions/CCCameraAction.cpp b/cocos2dx/actions/CCCameraAction.cpp index 97c61836d1..2c40dbd777 100644 --- a/cocos2dx/actions/CCCameraAction.cpp +++ b/cocos2dx/actions/CCCameraAction.cpp @@ -21,10 +21,11 @@ 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 #include "CCCameraAction.h" #include "CCNode.h" #include "CCCamera.h" +#include "platform/CCXMath.h" + namespace cocos2d{ // // CameraAction @@ -97,11 +98,11 @@ namespace cocos2d{ CCIntervalAction::startWithTarget(pTarget); float r, zenith, azimuth; this->sphericalRadius(&r, &zenith, &azimuth); - if( _isnan(m_fRadius) ) + if( CCXMath::isnanCocos2d(m_fRadius) ) m_fRadius = r; - if( _isnan(m_fAngleZ) ) + if( CCXMath::isnanCocos2d(m_fAngleZ) ) m_fAngleZ = (CGFloat)CC_RADIANS_TO_DEGREES(zenith); - if( _isnan(m_fAngleX) ) + if( CCXMath::isnanCocos2d(m_fAngleX) ) m_fAngleX = (CGFloat)CC_RADIANS_TO_DEGREES(azimuth); m_fRadZ = (CGFloat)CC_DEGREES_TO_RADIANS(m_fAngleZ); diff --git a/cocos2dx/actions/CCIntervalAction.cpp b/cocos2dx/actions/CCIntervalAction.cpp index cf6fa6adf2..d3475b9616 100644 --- a/cocos2dx/actions/CCIntervalAction.cpp +++ b/cocos2dx/actions/CCIntervalAction.cpp @@ -26,8 +26,8 @@ THE SOFTWARE. #include "CCSprite.h" #include "CCNode.h" #include "CGPointExtension.h" +#include "platform/CCXMath.h" -#include #include namespace cocos2d { @@ -542,7 +542,7 @@ bool CCSpawn:: initOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAct ccTime d2 = pAction2->getDuration(); // __super::initWithDuration(fmaxf(d1, d2)); - float maxd = (d1 >= d2 || _isnan(d2)) ? d1 : d2; + float maxd = (d1 >= d2 || CCXMath::isnanCocos2d(d2)) ? d1 : d2; CCIntervalAction::initWithDuration(maxd); m_pOne = pAction1; diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index a25a02c83f..577de0c874 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -411,7 +411,7 @@ void CCNode::cleanup() char * CCNode::description() { char *ret = new char[100] ; - sprintf_s(ret, 100, "", m_nTag); + sprintf(ret, "", m_nTag); return ret; } diff --git a/cocos2dx/cocos2dx-uphone.vcproj b/cocos2dx/cocos2dx-uphone.vcproj index 2894a3d1d6..5a623d2601 100644 --- a/cocos2dx/cocos2dx-uphone.vcproj +++ b/cocos2dx/cocos2dx-uphone.vcproj @@ -848,6 +848,10 @@ RelativePath=".\platform\CCXEGLView_platform.h" > + + diff --git a/cocos2dx/menu_nodes/CCMenu.cpp b/cocos2dx/menu_nodes/CCMenu.cpp index 4f8207d914..314bd7fe30 100644 --- a/cocos2dx/menu_nodes/CCMenu.cpp +++ b/cocos2dx/menu_nodes/CCMenu.cpp @@ -27,6 +27,7 @@ THE SOFTWARE. #include "CGPointExtension.h" #include "CCTouchDispatcher.h" #include "CCTouch.h" +#include "platform/CCXMath.h" #include #include @@ -317,7 +318,7 @@ namespace cocos2d{ assert(rowColumns); float tmp = (*it)->getContentSize().height; - rowHeight = (unsigned int)((rowHeight >= tmp || _isnan(tmp)) ? rowHeight : tmp); + rowHeight = (unsigned int)((rowHeight >= tmp || CCXMath::isnanCocos2d(tmp)) ? rowHeight : tmp); ++columnsOccupied; if (columnsOccupied >= rowColumns) @@ -361,7 +362,7 @@ namespace cocos2d{ } float tmp = (*it)->getContentSize().height; - rowHeight = (unsigned int)((rowHeight >= tmp || _isnan(tmp)) ? rowHeight : tmp); + rowHeight = (unsigned int)((rowHeight >= tmp || CCXMath::isnanCocos2d(tmp)) ? rowHeight : tmp); (*it)->setPosition(ccp(x - winSize.width / 2, y - (*it)->getContentSize().height / 2)); @@ -430,7 +431,7 @@ namespace cocos2d{ // columnWidth = fmaxf(columnWidth, [item contentSize].width); float tmp = (*it)->getContentSize().width; - columnWidth = (unsigned int)((columnWidth >= tmp || _isnan(tmp)) ? columnWidth : tmp); + columnWidth = (unsigned int)((columnWidth >= tmp || CCXMath::isnanCocos2d(tmp)) ? columnWidth : tmp); columnHeight += (int)((*it)->getContentSize().height + 5); ++rowsOccupied; @@ -478,7 +479,7 @@ namespace cocos2d{ // columnWidth = fmaxf(columnWidth, [item contentSize].width); float tmp = (*it)->getContentSize().width; - columnWidth = (unsigned int)((columnWidth >= tmp || _isnan(tmp)) ? columnWidth : tmp); + columnWidth = (unsigned int)((columnWidth >= tmp || CCXMath::isnanCocos2d(tmp)) ? columnWidth : tmp); (*it)->setPosition(ccp(x + columnWidths[column] / 2, y - winSize.height / 2));