promoted StatsWrapper struct into class

altered deck editor information display for statistics
This commit is contained in:
techdragon.nguyen@gmail.com
2010-11-07 18:28:54 +00:00
parent 2d31cbdaf5
commit 61cc3692a5
8 changed files with 338 additions and 268 deletions

View File

@@ -78,51 +78,6 @@ enum DECK_VIEWER_MENU_ITEMS
#define MAX_SAVED_FILTERS 8
static const int STATS_FOR_TURNS = 8;
static const int STATS_MAX_MANA_COST = 9;
// Struct to hold statistics-related stuff
struct StatsWrapper {
// Stats parameters and status
int currentPage;
int pageCount;
bool needUpdate;
// Actual stats
int percentVictories;
int gamesPlayed;
int cardCount;
int countLands;
int totalPrice;
int totalManaCost;
float avgManaCost;
int totalCreatureCost;
float avgCreatureCost;
int totalSpellCost;
float avgSpellCost;
int countManaProducers;
int countCreatures, countSpells, countInstants, countEnchantments, countSorceries, countArtifacts;
float noLandsProbInTurn[STATS_FOR_TURNS];
float noCreaturesProbInTurn[STATS_FOR_TURNS];
int countCardsPerCost[STATS_MAX_MANA_COST+1];
int countCardsPerCostAndColor[STATS_MAX_MANA_COST+1][Constants::MTG_NB_COLORS+1];
int countCreaturesPerCost[STATS_MAX_MANA_COST+1];
int countCreaturesPerCostAndColor[STATS_MAX_MANA_COST+1][Constants::MTG_NB_COLORS+1];
int countSpellsPerCost[STATS_MAX_MANA_COST+1];
int countSpellsPerCostAndColor[STATS_MAX_MANA_COST+1][Constants::MTG_NB_COLORS+1];
int countLandsPerColor[Constants::MTG_NB_COLORS+1];
int countBasicLandsPerColor[Constants::MTG_NB_COLORS+1];
int countNonLandProducersPerColor[Constants::MTG_NB_COLORS+1];
int totalCostPerColor[Constants::MTG_NB_COLORS+1];
int totalColoredSymbols;
vector<string> aiDeckNames;
vector<DeckStat*> aiDeckStats;
};
class GameStateDeckViewer: public GameState, public JGuiListener
{
private:
@@ -156,10 +111,11 @@ private:
DeckDataWrapper * myDeck;
DeckDataWrapper * myCollection;
MTGCard * cardIndex[7];
StatsWrapper *stw;
int hudAlpha;
string newDeckname;
bool isAIDeckSave;
StatsWrapper stw;
bool mSwitching;
void saveDeck(); //Saves the deck and additional necessary information
void saveAsAIDeck(string deckName); // saves deck as an AI Deck
@@ -185,7 +141,9 @@ public:
virtual void renderCard(int id, float rotation);
virtual void renderCard (int id);
virtual void Render();
int loadDeck(int deckid);
int loadDeck(int deckid);
void LoadDeckStatistics(int deckId);
void buildEditorMenu();
virtual void ButtonPressed(int controllerId, int controlId);
void updateStats();