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:
@@ -364,6 +364,22 @@ void ShopItems::ButtonPressed(int controllerId, int controlId){
|
||||
tempDeck->addRandomCards(3, sets,1,Constants::RARITY_U);
|
||||
tempDeck->addRandomCards(11, sets,1,Constants::RARITY_C);
|
||||
|
||||
//Check for duplicates. Does not guarentee none, just makes them extremely unlikely.
|
||||
//Code is kind of inefficient, but shouldn't be used often enough to matter.
|
||||
int loops=0;
|
||||
for(map<int,int>::iterator it = tempDeck->cards.begin();it!= tempDeck->cards.end() && loops < 15;it++,loops++){
|
||||
int dupes = it->second - 1;
|
||||
if(dupes <= 0)
|
||||
continue;
|
||||
|
||||
for(int x=0;x<dupes;x++)
|
||||
tempDeck->remove(it->first);
|
||||
|
||||
int rarity = (int) tempDeck->database->getCardById(it->first)->getRarity();
|
||||
tempDeck->addRandomCards(dupes,&rarity);
|
||||
it = tempDeck->cards.begin();
|
||||
}
|
||||
|
||||
playerdata->collection->add(tempDeck);
|
||||
myCollection->Add(tempDeck);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user