reimplemented mana color display for deck selection. This is now totally controlled by

stats generation.  No data needs to be written to the deck master files themselves.
Now the mana colors will only show if you have battled with a particular deck at least once.
This is not retroactive, so you will need to battle the ai again.  This can not be edited manually
either to prevent tampering with the statistical data.  Player deck mana color display is also
covered this way.

Decks will still be saved in the new layout if a disk write is necessary.  So any changes via
the deck editor will result in a deck file rewrite is was always the case.:)
This commit is contained in:
techdragon.nguyen@gmail.com
2011-02-10 17:19:11 +00:00
parent e3ac27bc30
commit 93c63cef3d
9 changed files with 70 additions and 80 deletions

View File

@@ -775,12 +775,6 @@ MTGDeck::MTGDeck(const char * config_file, MTGAllCards * _allcards, int meta_onl
meta_desc.append(s.substr(found + 5));
continue;
}
found = s.find("MANA:");
if ( found != string::npos )
{
string colorIndex = s.substr(found + 5);
meta_deck_colors = trim(colorIndex);
}
continue;
}
if (meta_only) break;
@@ -1042,26 +1036,7 @@ int MTGDeck::save(const string& destFileName, bool useExpandedDescriptions, cons
bool saveDetailedDeckInfo = options.get( Options::SAVEDETAILEDDECKINFO )->number == 1;
if ( filename.find("collection.dat") == string::npos )
{
// add in color information
DeckManager *deckManager = DeckManager::GetInstance();
file <<"#MANA:";
string deckId = filename.substr( filename.find("/deck")+5, filename.find(".txt") - (filename.find("/deck")+5) );
bool isAI = filename.find("ai/baka") != string::npos;
StatsWrapper *stats = deckManager->getExtendedStatsForDeckId( atoi(deckId.c_str()), this->database, isAI );
for (int i = Constants::MTG_COLOR_ARTIFACT; i < Constants::MTG_COLOR_LAND; ++i)
{
if (stats->totalCostPerColor[i] != 0)
file << "1";
else
file <<"0";
}
file << endl;
}
else
if ( filename.find("collection.dat") != string::npos )
saveDetailedDeckInfo = false;
if (useExpandedDescriptions || saveDetailedDeckInfo)