From 827fa638ca293b6c6a968e084dc8b39044930840 Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Wed, 29 May 2013 15:49:34 -0700 Subject: [PATCH] Adds support for "CCString" types for boolean and integers --- cocos2dx/CCConfiguration.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cocos2dx/CCConfiguration.cpp b/cocos2dx/CCConfiguration.cpp index 154efb8ceb..af9ff6c13c 100644 --- a/cocos2dx/CCConfiguration.cpp +++ b/cocos2dx/CCConfiguration.cpp @@ -240,8 +240,10 @@ bool CCConfiguration::getBool( const char *key ) const { CCObject *ret = m_pDefaults->objectForKey(key); if( ret ) { - if( CCBool *obj=dynamic_cast(ret) ) - return obj->getValue(); + if( CCBool *boolobj=dynamic_cast(ret) ) + return boolobj->getValue(); + if( CCString *strobj=dynamic_cast(ret) ) + return strobj->boolValue(); CCAssert(false, "Key found, but from different type"); } @@ -261,6 +263,9 @@ double CCConfiguration::getNumber( const char *key ) const if( CCInteger *obj=dynamic_cast(ret) ) return obj->getValue(); + if( CCString *strobj=dynamic_cast(ret) ) + return strobj->doubleValue(); + CCAssert(false, "Key found, but from different type"); }