diff --git a/core/2d/SpriteFrameCache.cpp b/core/2d/SpriteFrameCache.cpp index 98ccea60157..12af13d61f6 100644 --- a/core/2d/SpriteFrameCache.cpp +++ b/core/2d/SpriteFrameCache.cpp @@ -258,11 +258,10 @@ void SpriteFrameCache::removeSpriteFramesFromTexture(Texture2D* texture) for (auto&& iter : getSpriteFrames()) { - auto key = iter.first; - auto* frame = findFrame(key); + auto* frame = findFrame(iter.first); if (frame && (frame->getTexture() == texture)) { - keysToRemove.emplace_back(key); + keysToRemove.emplace_back(iter.first); } } @@ -326,8 +325,8 @@ bool SpriteFrameCache::eraseFrame(std::string_view frameName) { // drop SpriteFrame const auto itFrame = _spriteFrameToSpriteSheetMap.find(frameName); - bool hint = itFrame != _spriteFrameToSpriteSheetMap.end(); - if (hint) + bool found = itFrame != _spriteFrameToSpriteSheetMap.end(); + if (found) { auto& spriteSheet = itFrame->second; spriteSheet->full = false; @@ -347,7 +346,7 @@ bool SpriteFrameCache::eraseFrame(std::string_view frameName) //} } _spriteFrames.erase(frameName); - return hint; + return found; } bool SpriteFrameCache::eraseFrames(const std::vector& frames)