Jeck - Cache now pretty damn near guarantees successful retrieval.

* The only fail condition is if all resources are locked, or the file doesn't exist at all.
This commit is contained in:
wagic.jeck
2009-09-09 05:02:08 +00:00
parent e3d86f0824
commit 4993cc5dea
2 changed files with 45 additions and 7 deletions

View File

@@ -6,8 +6,14 @@
#include "MTGDeck.h"
#include "MTGCard.h"
#ifdef WIN32
#define CACHE_SIZE_PIXELS 20000000
#define MAX_CACHE_OBJECTS 2000
#else
#define CACHE_SIZE_PIXELS 2000000
#define MAX_CACHE_OBJECTS 200
#endif
class WCachedResource{
public:
@@ -111,8 +117,11 @@ public:
private:
bool RemoveOldestTexture();
bool RemoveOldestSample();
bool cleanup();
JTexture * attemptTexture(string filename, int mode = 0, int format = TEXTURE_FORMAT);
WCachedTexture * getCachedTexture(string filename, bool makenew = true, int mode = 0, int format = TEXTURE_FORMAT);
WCachedTexture * getCachedCard(MTGCard * card, int type = CACHE_CARD, bool makenew = true);
WCachedSample * getCachedSample(string filename, bool makenew = true);