mirror of https://github.com/axmolengine/axmol.git
Merge pull request #2672 from ricardoquesada/configuration_get_value_fix
Adds support for "CCString" types for boolean and integers
This commit is contained in:
commit
038cc86537
|
@ -240,8 +240,10 @@ bool CCConfiguration::getBool( const char *key ) const
|
||||||
{
|
{
|
||||||
CCObject *ret = m_pDefaults->objectForKey(key);
|
CCObject *ret = m_pDefaults->objectForKey(key);
|
||||||
if( ret ) {
|
if( ret ) {
|
||||||
if( CCBool *obj=dynamic_cast<CCBool*>(ret) )
|
if( CCBool *boolobj=dynamic_cast<CCBool*>(ret) )
|
||||||
return obj->getValue();
|
return boolobj->getValue();
|
||||||
|
if( CCString *strobj=dynamic_cast<CCString*>(ret) )
|
||||||
|
return strobj->boolValue();
|
||||||
CCAssert(false, "Key found, but from different type");
|
CCAssert(false, "Key found, but from different type");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,6 +263,9 @@ double CCConfiguration::getNumber( const char *key ) const
|
||||||
if( CCInteger *obj=dynamic_cast<CCInteger*>(ret) )
|
if( CCInteger *obj=dynamic_cast<CCInteger*>(ret) )
|
||||||
return obj->getValue();
|
return obj->getValue();
|
||||||
|
|
||||||
|
if( CCString *strobj=dynamic_cast<CCString*>(ret) )
|
||||||
|
return strobj->doubleValue();
|
||||||
|
|
||||||
CCAssert(false, "Key found, but from different type");
|
CCAssert(false, "Key found, but from different type");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue