- fixed card id collisions in Legends, Ravnica, Portal
- Changed Deck and Database structures with better design (a bit faster, hopefully a lot cleaner)
- updated Windows project file
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-06-06 04:46:54 +00:00
parent 01bd44025d
commit ab42e5db06
13 changed files with 166 additions and 145 deletions
+2 -2
View File
@@ -32,11 +32,11 @@ class DeckDataWrapper{
DeckDataWrapper(MTGDeck * deck);
~DeckDataWrapper();
int Add(MTGCard * card);
int Add(MTGCard * card, int quantity = 1);
int Remove(MTGCard * card);
MTGCard * getNext(MTGCard * previous = NULL, int color = -1);
MTGCard * getPrevious(MTGCard * next = NULL, int color = -1);
void updateCounts(MTGCard * card = NULL, int removed = 0);
void updateCounts(MTGCard * card = NULL, int quantity = 1);
int getCount(int color = -1);
int totalPrice();
void save();
+16 -5
View File
@@ -42,6 +42,8 @@ class MtgSets{
class MTGAllCards {
private:
MTGCard * tempCard;
protected:
int conf_read_mode;
int colorsCount[Constants::MTG_NB_COLORS];
@@ -52,12 +54,12 @@ class MTGAllCards {
public:
TexturesCache * mCache;
MTGCard * _(int i);
vector<MTGCard *> collection;
//collection[Constants::TOTAL_NUMBER_OF_CARDS];
vector<int> ids;
map<int, MTGCard *> collection;
MTGAllCards();
~MTGAllCards();
MTGAllCards(TexturesCache * cache);
MTGCard * _(int id);
void destroyAllCards();
MTGAllCards(const char * config_file, const char * set_name);
MTGAllCards(const char * config_file, const char * set_name, TexturesCache * cache);
@@ -75,22 +77,31 @@ class MTGAllCards {
};
class MTGDeck:public MTGAllCards{
class MTGDeck{
protected:
string filename;
MTGAllCards * allcards;
int total_cards;
public:
TexturesCache * mCache;
MTGAllCards * database;
map <int,int> cards;
string meta_desc;
string meta_name;
int totalCards();
MTGDeck(TexturesCache * cache, MTGAllCards * _allcards);
MTGDeck(const char * config_file, TexturesCache * cache, MTGAllCards * _allcards, int meta_only = 0);
int addRandomCards(int howmany, int setId = -1, int rarity = -1, const char * subtype = NULL);
int add(int cardid);
int add(MTGDeck * deck); // adds the contents of "deck" into myself
int remove(int cardid);
int removeAll();
int add(MTGCard * card);
int remove(MTGCard * card);
int save();
MTGCard * getCardById(int id);
};