Erwan
-fixed a memory leak - Added P02 and PTK - New way to create tokens in the parser, much more flexible, see the Hive in RV. Tokens can now be written as other cards, with a rarity of "T". I suggest their id to be the negative value of the card that generates them when possible. Naming convention for images is the same as before: a negative id such as -1138 will need a [id]t.jpg image (1138t.jpg). Positive ids work as "normal" pictures
This commit is contained in:
@@ -447,12 +447,7 @@ int MTGDeck::addRandomCards(int howmany, int * setIds, int nbSets, int rarity, c
|
||||
|
||||
int collectionTotal = database->totalCards();
|
||||
if (!collectionTotal) return 0;
|
||||
if (nbSets == 0 && rarity == -1 && !_subtype && !nbcolors){
|
||||
for (int i = 0; i < howmany; i++){
|
||||
add(database->randomCardId());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
char subtype[4096];
|
||||
if (_subtype)
|
||||
sprintf(subtype, _subtype);
|
||||
@@ -462,7 +457,8 @@ int MTGDeck::addRandomCards(int howmany, int * setIds, int nbSets, int rarity, c
|
||||
int subtotal = 0;
|
||||
for (int i = 0; i < collectionTotal; i++){
|
||||
MTGCard * card = database->_(i);
|
||||
if ((rarity == -1 || card->getRarity()==rarity) &&
|
||||
int r = card->getRarity();
|
||||
if (r != Constants::RARITY_T && (rarity == -1 || r==rarity) &&
|
||||
(!_subtype || card->hasSubtype(subtype))
|
||||
){
|
||||
int ok = 0;
|
||||
@@ -612,6 +608,12 @@ MTGSets setlist; //Our global.
|
||||
MTGSets::MTGSets(){
|
||||
}
|
||||
|
||||
MTGSets::~MTGSets(){
|
||||
for (size_t i = 0; i < setinfo.size(); ++i){
|
||||
delete (setinfo[i]);
|
||||
}
|
||||
}
|
||||
|
||||
MTGSetInfo* MTGSets::getInfo(int setID){
|
||||
if(setID < 0 || setID >= (int) setinfo.size())
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user