Jeck - Card ID collisions, cache fixes, cache deleted pooling.

* mtgid now defaults to 0.
 * TextScroller will not update when empty.
 * Cache now moves WCachedResources we're finished with to a garbage pool for later use (to reduce memory fragmentation). 
 * Demo still crashes... but I'm thinking that has to do with fragmentation, not a leak?
This commit is contained in:
wagic.jeck
2009-09-19 01:48:42 +00:00
parent 5d57693d31
commit 4b8d344bcd
11 changed files with 893 additions and 738 deletions

View File

@@ -15,7 +15,8 @@ public:
WResource();
virtual ~WResource();
virtual void Trash()=0; //Delete the cacheActual.
virtual void Nullify()=0; //For when our size is 0, so we don't free anything by mistake.
virtual unsigned long size()=0; //Size of cached item in bytes.
virtual bool isGood()=0; //Return true if this has data.
@@ -38,6 +39,8 @@ public:
friend class WResourceManager;
template<class cacheItem,class cacheActual> friend class WCache;
virtual ~WCachedResource() {};
virtual void Refresh(string filename)=0; //Basically calls Attempt(filename) and remaps in situ.
virtual bool Attempt(string filename, int submode, int & error)=0; //Returns true if we've loaded our data and isGood().
};
@@ -48,6 +51,7 @@ public:
WTrackedQuad(string _resname);
~WTrackedQuad();
void Nullify();
void Trash();
unsigned long size();
bool isGood();
@@ -73,6 +77,7 @@ public:
bool compare(JTexture * t) {return (t == texture);};
void Nullify();
void Trash();
JTexture * Actual(); //Return this texture as is. Does not make a new one.
JQuad * GetQuad(string resname);
@@ -86,6 +91,7 @@ protected:
JTexture * texture;
bool bVRAM;
vector<WTrackedQuad*> trackedQuads;
static vector<WTrackedQuad*> garbageTQs;
};
class WCachedParticles: public WCachedResource{
@@ -96,6 +102,7 @@ public:
~WCachedParticles();
void Nullify();
void Trash();
void Refresh(string filename);
unsigned long size();
bool isGood();
@@ -114,6 +121,7 @@ public:
WCachedSample();
~WCachedSample();
void Nullify();
void Trash();
bool compare(JSample * s) {return (s == sample);};
unsigned long size();
bool isGood();