* 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.
This commit is contained in:
techdragon.nguyen@gmail.com
2010-11-29 12:45:48 +00:00
parent 8de00561d5
commit 4badcc374f
3 changed files with 17 additions and 9 deletions
+3 -2
View File
@@ -311,8 +311,9 @@ void DeckMenu::updateScroller()
for (vector<Task*>::iterator it = taskList.tasks.begin(); it != taskList.tasks.end(); it++) for (vector<Task*>::iterator it = taskList.tasks.begin(); it != taskList.tasks.end(); it++)
{ {
ostringstream taskDescription; ostringstream taskDescription;
taskDescription << "[ " << setw(4) << (*it)->getReward() << " / " << (*it)->getExpiration() << " ] " taskDescription << "Credits: " << setw(4) << (*it)->getReward() << " / "
<< (*it)->getDesc() << endl << endl; << "Days Left: " << (*it)->getExpiration() << endl
<< (*it)->getDesc() << endl << endl;
mScroller->Add(taskDescription.str()); mScroller->Add(taskDescription.str());
} }
+9 -7
View File
@@ -8,6 +8,7 @@
#include <math.h> #include <math.h>
#include "GameStateMenu.h" #include "GameStateMenu.h"
#include "DeckManager.h"
#include "MenuItem.h" #include "MenuItem.h"
#include "GameOptions.h" #include "GameOptions.h"
#include "GameApp.h" #include "GameApp.h"
@@ -191,23 +192,24 @@ void GameStateMenu::fillScroller()
char buff2[512]; char buff2[512];
DeckStats * stats = DeckStats::GetInstance(); DeckStats * stats = DeckStats::GetInstance();
DeckManager *deckManager = DeckManager::GetInstance();
vector<DeckMetaData *> playerDecks = getValidDeckMetaData(options.profileFile());
int totalGames = 0; int totalGames = 0;
for (size_t j = 0; j < playerDecks.size(); j++)
for (int j = 1; j < 6; 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); string deckstats = options.profileFile(buffer);
if (fileExists(deckstats.c_str())) if (fileExists(deckstats.c_str()))
{ {
stats->load(deckstats.c_str()); stats->load(deckstats.c_str());
int percentVictories = stats->percentVictories(); 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); scroller->Add(buff2);
int nbGames = stats->nbGames(); sprintf(buff2, _("You have played %i games with \"%s\"").c_str(), meta->getGamesPlayed(), meta->getName().c_str());
totalGames += nbGames;
sprintf(buff2, _("You have played %i games with Deck%i").c_str(), nbGames, j);
scroller->Add(buff2); scroller->Add(buff2);
totalGames += meta->getGamesPlayed();
} }
} }
if (totalGames) if (totalGames)
+5
View File
@@ -181,6 +181,11 @@ std::string VerticalTextScroller::wordWrap(std::string sentence, float width)
numLines++; numLines++;
} }
} }
else if ( sentence[idx] == '\n' )
{
numLines++;
breakIdx = idx;
}
} }
if ( numLines * mFont->GetHeight() > mHeight ) if ( numLines * mFont->GetHeight() > mHeight )
mScrollerInitialized = true; mScrollerInitialized = true;