Jeck - Fixed an error with packs, fixed basic info in deck editor, removed duplicated code in DeckDataWrapper.

This commit is contained in:
wagic.jeck
2010-02-17 03:10:56 +00:00
parent ebaeb96450
commit a123cebfe5
11 changed files with 113 additions and 125 deletions

View File

@@ -62,7 +62,8 @@ public:
virtual JQuad * getImage(int offset=0);
virtual JQuad * getThumb(int offset=0);
virtual MTGCard * getCard(int offset=0, bool ignore=false);
virtual int Size(bool all=false); //Returns the number of cards currently matched
virtual int Size(bool all=false); //Returns the number of cards, or the number of cards that match the filter.
virtual void Shuffle();
virtual bool thisCard(int mtgid);
@@ -76,16 +77,20 @@ public:
virtual void clearFilters();
virtual WCardFilter* unhookFilters();
virtual bool matchesFilters(MTGCard * c);
virtual void validateFilters();
virtual void validate();
virtual void bakeFilters(); //Discards all invalidated cards.
virtual float filterFee();
virtual void updateCounts() {};
virtual void clearCounts() {};
virtual void addCount(MTGCard * c, int qty=1) {};
//Loads into us.
//Loads into us. Calls validate()
virtual int loadMatches(MTGAllCards* ac); //loadMatches adds the cards from something
virtual int loadMatches(MTGDeck * deck); //into this, if it matches our filter
virtual int loadMatches(WSrcCards* src, bool all=false); //If all==true, ignore filters on src.
//We load it
//We put it into something else
virtual int addRandomCards(MTGDeck * i, int howmany=1);
virtual int addToDeck(MTGDeck * i, int num=-1); //Returns num that didn't add
@@ -109,7 +114,7 @@ public:
class WSrcDeck: public WSrcCards{
public:
WSrcDeck(float delay=0.2) : WSrcCards(delay) {totalCards=0;};
WSrcDeck(float delay=0.2) : WSrcCards(delay) {clearCounts();};
virtual int loadMatches(MTGDeck * deck);
virtual int Add(MTGCard * c, int quantity=1);
virtual int Remove(MTGCard * c, int quantity=1, bool erase=false);
@@ -117,10 +122,23 @@ public:
int count(MTGCard * c);
int countByName(MTGCard * card, bool editions=false);
int totalPrice();
int totalCopies();
enum {
//0 to MTG_NB_COLORS are colors. See MTG_COLOR_ in Constants::.
UNFILTERED_COPIES = Constants::MTG_NB_COLORS,
UNFILTERED_UNIQUE,
UNFILTERED_MIN_COPIES, //For 'unlock all' cheat, awards screen
UNFILTERED_MAX_COPIES, //future use in format restriction, awards screen
FILTERED_COPIES,
FILTERED_UNIQUE,
MAX_COUNTS
};
void clearCounts();
void updateCounts();
void addCount(MTGCard * c, int qty=1);
int getCount(int count=UNFILTERED_COPIES);
protected:
map<int,int> copies; //Maps MTGID to card counts.
int totalCards;
int counts[MAX_COUNTS];
};
struct WCSortCollector{