mirror of https://github.com/axmolengine/axmol.git
fix bugs in CCDictionary & platform/win32/CCImage.cpp::setFont, according to BitWave's codereview.
This commit is contained in:
parent
9d9f69186e
commit
16afe5b616
|
@ -91,8 +91,11 @@ CCArray* CCDictionary::allKeysForObject(CCObject* object)
|
||||||
|
|
||||||
CCObject* CCDictionary::objectForKey(const std::string& key)
|
CCObject* CCDictionary::objectForKey(const std::string& key)
|
||||||
{
|
{
|
||||||
if (m_eDictType == kCCDictUnknown && m_eDictType == kCCDictUnknown) return NULL;
|
if (m_eDictType != kCCDictStr)
|
||||||
CCAssert(m_eDictType == kCCDictStr, "this dictionary does not use string as key.");
|
{
|
||||||
|
CCAssert(m_eDictType == kCCDictStr, "this dictionary does not use string as key.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
CCObject* pRetObject = NULL;
|
CCObject* pRetObject = NULL;
|
||||||
CCDictElement *pElement = NULL;
|
CCDictElement *pElement = NULL;
|
||||||
|
@ -106,8 +109,11 @@ CCObject* CCDictionary::objectForKey(const std::string& key)
|
||||||
|
|
||||||
CCObject* CCDictionary::objectForKey(int key)
|
CCObject* CCDictionary::objectForKey(int key)
|
||||||
{
|
{
|
||||||
if (m_eDictType == kCCDictUnknown && m_eDictType == kCCDictUnknown) return NULL;
|
if (m_eDictType != kCCDictInt)
|
||||||
CCAssert(m_eDictType == kCCDictInt, "this dictionary does not use integer as key.");
|
{
|
||||||
|
CCAssert(m_eDictType == kCCDictInt, "this dictionary does not use integer as key.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
CCObject* pRetObject = NULL;
|
CCObject* pRetObject = NULL;
|
||||||
CCDictElement *pElement = NULL;
|
CCDictElement *pElement = NULL;
|
||||||
|
|
|
@ -126,8 +126,8 @@ public:
|
||||||
}
|
}
|
||||||
GetObjectA(m_hFont, sizeof(tOldFont), &tOldFont);
|
GetObjectA(m_hFont, sizeof(tOldFont), &tOldFont);
|
||||||
|
|
||||||
if (tOldFont.lfHeight == tNewFont.lfHeight
|
if (tOldFont.lfHeight == tNewFont.lfHeight &&
|
||||||
&& ! strcpy(tOldFont.lfFaceName, tNewFont.lfFaceName))
|
!strcmp(tOldFont.lfFaceName, tNewFont.lfFaceName))
|
||||||
{
|
{
|
||||||
// already has the font
|
// already has the font
|
||||||
bRet = true;
|
bRet = true;
|
||||||
|
|
Loading…
Reference in New Issue