Jeck - Profile and cache improvements, booster duplicate likelihood reduced.

* Cache now tracks missing textures for RetrieveQuad, not just RetrieveCard/RetrieveTexture.
* Profile options are no longer overwritten when switching profiles.
* Main menu notifies of alternate profile- "Database: X" becomes "Profile: Y of X cards."
* Boosters iterates through cards, replacing duplicates. Stops after 15 tries to prevent infinite loops on small sets.
* Very simplistic theme switcher, only displays when alternate themes are present.
This commit is contained in:
wagic.jeck
2009-09-08 03:23:19 +00:00
parent a0b1da9810
commit ad7006e2de
9 changed files with 145 additions and 49 deletions
+1
View File
@@ -75,6 +75,7 @@ public:
string str;
//All calls to asColor should include a fallback color for people without a theme.
PIXEL_TYPE asColor(PIXEL_TYPE fallback = ARGB(255,255,255,255));
bool isDefault(); //Returns true when number is 0 abd string is "" or "default"
GameOption(int value = 0);
GameOption(string value);
};
+8
View File
@@ -24,6 +24,7 @@ public:
string displayValue, id;
int hasFocus;
bool canSelect;
bool bHidden;
float x, y;
float width, height;
virtual ostream& toString(ostream& out)const;
@@ -31,6 +32,7 @@ public:
OptionItem( string _id, string _displayValue);
virtual ~OptionItem() {};
virtual bool Selectable() {return (canSelect && !bHidden);};
virtual void Entering();
virtual bool Leaving();
virtual void Update(float dt);
@@ -69,6 +71,7 @@ class OptionString:public OptionItem{
virtual ostream& toString(ostream& out) const;
bool bShowValue;
};
class OptionNewProfile:public OptionString{
public:
OptionNewProfile(string _id, string _displayValue) : OptionString(_id, _displayValue) {bShowValue=false;};
@@ -118,6 +121,11 @@ private:
string root;
};
class OptionTheme:public OptionDirectory{
public:
OptionTheme();
};
class OptionProfile:public OptionDirectory{
public:
OptionProfile(GameApp * _app);
+4 -2
View File
@@ -7,7 +7,7 @@
#include "MTGCard.h"
#define CACHE_SIZE_PIXELS 2000000
#define MAX_CACHE_OBJECTS 100
#define MAX_CACHE_OBJECTS 200
class WCachedResource{
public:
@@ -84,6 +84,7 @@ public:
void ClearMisses();
void ClearUnlocked();
void ClearSamples();
void Refresh(); //Refreshes all files in cache, for when mode/profile changes.
unsigned int nowTime();
@@ -111,7 +112,6 @@ private:
bool RemoveOldestTexture();
bool RemoveOldestSample();
bool cleanup();
void clearSamples();
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);
@@ -121,6 +121,8 @@ private:
//For cached stuff
map<string,WCachedTexture*> textureCache;
map<string,WCachedSample*> sampleCache;
vector<string> mTextureMissing; //For managed textures.
//Current access time.
int lastTime;