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

@@ -34,6 +34,7 @@ void DeckMetaData::LoadStats()
mPercentVictories = stats->percentVictories(mStatsFilename);
mVictories = opponentDeckStats->victories;
mGamesPlayed = opponentDeckStats->nbgames;
mColorIndex = opponentDeckStats->manaColorIndex;
ostringstream oss;
int deckFilenameOffset = mStatsFilename.find("deck") + 4;
int oppDeckId = atoi(mStatsFilename.substr(deckFilenameOffset, mStatsFilename.find_last_of(".")).c_str());
@@ -65,7 +66,7 @@ void DeckMetaData::LoadStats()
if (FileExists(mStatsFilename))
{
stats->load(mStatsFilename);
mGamesPlayed = stats->nbGames();
mGamesPlayed = stats->nbGames();
mPercentVictories = stats->percentVictories();
mVictories = static_cast<int>(mGamesPlayed * (mPercentVictories / 100.0f));
}
@@ -94,7 +95,6 @@ void DeckMetaData::LoadDeck()
mName = trim(deck.meta_name);
mDescription = trim(deck.meta_desc);
mDeckId = atoi((mFilename.substr(mFilename.find("deck") + 4, mFilename.find(".txt"))).c_str());
mColorIndex = deck.meta_deck_colors;
mDeckLoaded = true;
}