From 52dd0c2f915b2d06fed28dd6102468899811ac06 Mon Sep 17 00:00:00 2001 From: "wrenczes@gmail.com" Date: Wed, 20 Apr 2011 06:46:14 +0000 Subject: [PATCH] Removed the concept of cleaning up misses from the cache, as this was causing flickering on cards whose .zip files are missing. The idea now is that, if we can't load an image, keep the cache miss around permanently so that we never redundantly make a load attempt on that file again. --- projects/mtg/include/WResourceManagerImpl.h | 6 ------ projects/mtg/src/WResourceManager.cpp | 16 ---------------- 2 files changed, 22 deletions(-) diff --git a/projects/mtg/include/WResourceManagerImpl.h b/projects/mtg/include/WResourceManagerImpl.h index 75333eaf1..2447fcf4a 100644 --- a/projects/mtg/include/WResourceManagerImpl.h +++ b/projects/mtg/include/WResourceManagerImpl.h @@ -76,11 +76,6 @@ protected: int makeID(int id, const string& filename, int submode); //Makes an ID appropriate to the submode. - inline bool RequiresMissCleanup() - { - return (cacheItems < cache.size() /*&& cache.size() - cacheItems > MAX_CACHE_MISSES*/); - } - inline bool RequiresOldItemCleanup() { if (cacheItems > MAX_CACHE_OBJECTS || cacheItems > maxCached || cacheSize > maxCacheSize) @@ -147,7 +142,6 @@ public: bool IsThreaded(); - void Unmiss(string filename); JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL); JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL); JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL); diff --git a/projects/mtg/src/WResourceManager.cpp b/projects/mtg/src/WResourceManager.cpp index b35902022..b595a2e25 100644 --- a/projects/mtg/src/WResourceManager.cpp +++ b/projects/mtg/src/WResourceManager.cpp @@ -411,13 +411,6 @@ void ResourceManagerImpl::Release(JTexture * tex) return; //Released! } -void ResourceManagerImpl::Unmiss(string filename) -{ - map::iterator it; - int id = textureWCache.makeID(0, filename, CACHE_NORMAL); - textureWCache.RemoveMiss(id); -} - void ResourceManagerImpl::ClearUnlocked() { textureWCache.ClearUnlocked(); @@ -1337,15 +1330,6 @@ bool WCache::Cleanup() { bool result = true; // this looks redundant, but the idea is, don't grab the mutex if there's no work to do - if (RequiresMissCleanup()) - { - boost::mutex::scoped_lock lock(mCacheMutex); - while (RequiresMissCleanup()) - { - RemoveMiss(); - } - } - if (RequiresOldItemCleanup()) { boost::mutex::scoped_lock lock(mCacheMutex);