Erwan
- Yet Another Attempt at fixing i319,i365, i372
This commit is contained in:
@@ -55,6 +55,12 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class WSrcCards: public WDataSource{
|
class WSrcCards: public WDataSource{
|
||||||
|
protected:
|
||||||
|
vector<MTGCard*> cards;
|
||||||
|
vector<size_t> validated;
|
||||||
|
WCardFilter * filtersRoot;
|
||||||
|
float mDelay;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WSrcCards(float delay=0.2);
|
WSrcCards(float delay=0.2);
|
||||||
~WSrcCards();
|
~WSrcCards();
|
||||||
@@ -93,6 +99,7 @@ public:
|
|||||||
//We put it into something else
|
//We put it into something else
|
||||||
virtual int addRandomCards(MTGDeck * i, int howmany=1);
|
virtual int addRandomCards(MTGDeck * i, int howmany=1);
|
||||||
virtual int addToDeck(MTGDeck * i, int num=-1); //Returns num that didn't add
|
virtual int addToDeck(MTGDeck * i, int num=-1); //Returns num that didn't add
|
||||||
|
virtual WCardFilter * getFiltersRoot(){return filtersRoot;};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MAX_CYCLES = 4, //How many cycles to search, for addToDeck
|
MAX_CYCLES = 4, //How many cycles to search, for addToDeck
|
||||||
@@ -100,11 +107,7 @@ public:
|
|||||||
SORT_ALPHA,
|
SORT_ALPHA,
|
||||||
SORT_RARITY
|
SORT_RARITY
|
||||||
};
|
};
|
||||||
protected:
|
|
||||||
vector<MTGCard*> cards;
|
|
||||||
vector<size_t> validated;
|
|
||||||
WCardFilter * filtersRoot;
|
|
||||||
float mDelay;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class WSrcDeckViewer: public WSrcCards{
|
class WSrcDeckViewer: public WSrcCards{
|
||||||
@@ -118,6 +121,7 @@ public:
|
|||||||
JQuad * getThumb(int offset=0) {return active->getThumb(offset);};
|
JQuad * getThumb(int offset=0) {return active->getThumb(offset);};
|
||||||
MTGCard * getCard(int offset=0, bool ignore=false) {return active->getCard(offset,ignore);};
|
MTGCard * getCard(int offset=0, bool ignore=false) {return active->getCard(offset,ignore);};
|
||||||
int Size(bool all=false) {return active->Size();};
|
int Size(bool all=false) {return active->Size();};
|
||||||
|
WCardFilter * getfiltersRoot() {return active->getFiltersRoot();};
|
||||||
void Shuffle() {active->Shuffle();};
|
void Shuffle() {active->Shuffle();};
|
||||||
bool thisCard(int mtgid) {return active->thisCard(mtgid);};
|
bool thisCard(int mtgid) {return active->thisCard(mtgid);};
|
||||||
bool next() {return active->next();};
|
bool next() {return active->next();};
|
||||||
|
|||||||
@@ -440,8 +440,9 @@ void GameStateDeckViewer::renderOnScreenBasicInfo(){
|
|||||||
int allCopies, nowCopies;
|
int allCopies, nowCopies;
|
||||||
nowCopies = displayed_deck->getCount(WSrcDeck::FILTERED_COPIES);
|
nowCopies = displayed_deck->getCount(WSrcDeck::FILTERED_COPIES);
|
||||||
allCopies = displayed_deck->getCount(WSrcDeck::UNFILTERED_COPIES);
|
allCopies = displayed_deck->getCount(WSrcDeck::UNFILTERED_COPIES);
|
||||||
|
WCardFilter * wc = displayed_deck->getFiltersRoot();
|
||||||
|
|
||||||
if(allCopies != nowCopies)
|
if(wc)
|
||||||
sprintf(buffer, "%s %i of %i cards (%i unique)", (displayed_deck == myDeck) ? "DECK: " : " ", nowCopies,allCopies, displayed_deck->getCount(WSrcDeck::FILTERED_UNIQUE));
|
sprintf(buffer, "%s %i of %i cards (%i unique)", (displayed_deck == myDeck) ? "DECK: " : " ", nowCopies,allCopies, displayed_deck->getCount(WSrcDeck::FILTERED_UNIQUE));
|
||||||
else
|
else
|
||||||
sprintf(buffer, "%s%i cards (%i unique)", (displayed_deck == myDeck) ? "DECK: " : " " , allCopies, displayed_deck->getCount(WSrcDeck::UNFILTERED_UNIQUE));
|
sprintf(buffer, "%s%i cards (%i unique)", (displayed_deck == myDeck) ? "DECK: " : " " , allCopies, displayed_deck->getCount(WSrcDeck::UNFILTERED_UNIQUE));
|
||||||
@@ -1067,7 +1068,7 @@ void GameStateDeckViewer::updateStats() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(int ic=0;ic<myDeck->Size(true);ic++){
|
for(int ic=0;ic<myDeck->Size(true);ic++){
|
||||||
current = myDeck->getCard(ic);
|
current = myDeck->getCard(ic,true);
|
||||||
currentCost = current->data->getManaCost();
|
currentCost = current->data->getManaCost();
|
||||||
convertedCost = currentCost->getConvertedCost();
|
convertedCost = currentCost->getConvertedCost();
|
||||||
currentCount = myDeck->count(current);
|
currentCount = myDeck->count(current);
|
||||||
|
|||||||
@@ -407,12 +407,12 @@ void WSrcDeck::addCount(MTGCard * c, int qty){
|
|||||||
|
|
||||||
if(matchesFilters(c)){
|
if(matchesFilters(c)){
|
||||||
counts[FILTERED_COPIES]+=qty;
|
counts[FILTERED_COPIES]+=qty;
|
||||||
if(qty > 1 && cp != copies.end() && (*cp).second == qty ) counts[FILTERED_UNIQUE]++;
|
if(qty > 0 && cp != copies.end() && (*cp).second == qty ) counts[FILTERED_UNIQUE]++;
|
||||||
else if(qty < 1 && (cp == copies.end() || (*cp).second == 0) ) counts[FILTERED_UNIQUE]--;
|
else if(qty < 0 && (cp == copies.end() || (*cp).second == 0) ) counts[FILTERED_UNIQUE]--;
|
||||||
}
|
}
|
||||||
counts[UNFILTERED_COPIES] += qty;
|
counts[UNFILTERED_COPIES] += qty;
|
||||||
if(qty > 1 && cp != copies.end() && (*cp).second == qty ) counts[UNFILTERED_UNIQUE]++;
|
if(qty > 0 && cp != copies.end() && (*cp).second == qty ) counts[UNFILTERED_UNIQUE]++;
|
||||||
else if(qty < 1 && (cp == copies.end() || (*cp).second == 0) ) counts[UNFILTERED_UNIQUE]--;
|
else if(qty < 0 && (cp == copies.end() || (*cp).second == 0) ) counts[UNFILTERED_UNIQUE]--;
|
||||||
for(int i=Constants::MTG_COLOR_ARTIFACT;i<=Constants::MTG_COLOR_LAND;i++)
|
for(int i=Constants::MTG_COLOR_ARTIFACT;i<=Constants::MTG_COLOR_LAND;i++)
|
||||||
if (c->data->hasColor(i)) counts[i]+= qty;
|
if (c->data->hasColor(i)) counts[i]+= qty;
|
||||||
if(counts[UNFILTERED_MIN_COPIES] < 0 || qty < counts[UNFILTERED_MIN_COPIES]) counts[UNFILTERED_MIN_COPIES] = qty;
|
if(counts[UNFILTERED_MIN_COPIES] < 0 || qty < counts[UNFILTERED_MIN_COPIES]) counts[UNFILTERED_MIN_COPIES] = qty;
|
||||||
|
|||||||
Reference in New Issue
Block a user