From 4badcc374faf9355b4e67530b6d731a88ffa71c3 Mon Sep 17 00:00:00 2001 From: "techdragon.nguyen@gmail.com" Date: Mon, 29 Nov 2010 12:45:48 +0000 Subject: [PATCH] * modified task window to define what the bracketed numbers mean. * modified main page banner to use actual deck names and not the filename when displaying stats information. --- projects/mtg/src/DeckMenu.cpp | 5 +++-- projects/mtg/src/GameStateMenu.cpp | 16 +++++++++------- projects/mtg/src/TextScroller.cpp | 5 +++++ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/projects/mtg/src/DeckMenu.cpp b/projects/mtg/src/DeckMenu.cpp index 40d118694..8d8edc06c 100644 --- a/projects/mtg/src/DeckMenu.cpp +++ b/projects/mtg/src/DeckMenu.cpp @@ -311,8 +311,9 @@ void DeckMenu::updateScroller() for (vector::iterator it = taskList.tasks.begin(); it != taskList.tasks.end(); it++) { ostringstream taskDescription; - taskDescription << "[ " << setw(4) << (*it)->getReward() << " / " << (*it)->getExpiration() << " ] " - << (*it)->getDesc() << endl << endl; + taskDescription << "Credits: " << setw(4) << (*it)->getReward() << " / " + << "Days Left: " << (*it)->getExpiration() << endl + << (*it)->getDesc() << endl << endl; mScroller->Add(taskDescription.str()); } diff --git a/projects/mtg/src/GameStateMenu.cpp b/projects/mtg/src/GameStateMenu.cpp index 035d821f2..09caf6562 100644 --- a/projects/mtg/src/GameStateMenu.cpp +++ b/projects/mtg/src/GameStateMenu.cpp @@ -8,6 +8,7 @@ #include #include "GameStateMenu.h" +#include "DeckManager.h" #include "MenuItem.h" #include "GameOptions.h" #include "GameApp.h" @@ -191,23 +192,24 @@ void GameStateMenu::fillScroller() char buff2[512]; DeckStats * stats = DeckStats::GetInstance(); + DeckManager *deckManager = DeckManager::GetInstance(); + vector playerDecks = getValidDeckMetaData(options.profileFile()); int totalGames = 0; - - for (int j = 1; j < 6; j++) + for (size_t j = 0; j < playerDecks.size(); j++) { - sprintf(buffer, "stats/player_deck%i.txt", j); + DeckMetaData* meta = playerDecks[j]; + sprintf(buffer, "stats/player_deck%i.txt", meta->getDeckId()); string deckstats = options.profileFile(buffer); if (fileExists(deckstats.c_str())) { stats->load(deckstats.c_str()); int percentVictories = stats->percentVictories(); - sprintf(buff2, _("You have a %i%% victory ratio with Deck%i").c_str(), percentVictories, j); + sprintf(buff2, _("You have a %i%% victory ratio with \"%s\"").c_str(), percentVictories, meta->getName().c_str()); scroller->Add(buff2); - int nbGames = stats->nbGames(); - totalGames += nbGames; - sprintf(buff2, _("You have played %i games with Deck%i").c_str(), nbGames, j); + sprintf(buff2, _("You have played %i games with \"%s\"").c_str(), meta->getGamesPlayed(), meta->getName().c_str()); scroller->Add(buff2); + totalGames += meta->getGamesPlayed(); } } if (totalGames) diff --git a/projects/mtg/src/TextScroller.cpp b/projects/mtg/src/TextScroller.cpp index f87c6f8eb..8a22e7c89 100644 --- a/projects/mtg/src/TextScroller.cpp +++ b/projects/mtg/src/TextScroller.cpp @@ -181,6 +181,11 @@ std::string VerticalTextScroller::wordWrap(std::string sentence, float width) numLines++; } } + else if ( sentence[idx] == '\n' ) + { + numLines++; + breakIdx = idx; + } } if ( numLines * mFont->GetHeight() > mHeight ) mScrollerInitialized = true;