promoted StatsWrapper struct into class
altered deck editor information display for statistics
This commit is contained in:
@@ -1,11 +1,22 @@
|
||||
#pragma once
|
||||
#include "DeckMenu.h"
|
||||
#include "DeckDataWrapper.h"
|
||||
#include "DeckStats.h"
|
||||
|
||||
class DeckEditorMenu :
|
||||
public DeckMenu
|
||||
{
|
||||
protected:
|
||||
string deckTitle;
|
||||
|
||||
private:
|
||||
void drawDeckStatistics();
|
||||
|
||||
DeckDataWrapper *selectedDeck;
|
||||
StatsWrapper *stw;
|
||||
|
||||
public:
|
||||
DeckEditorMenu(int id, JGuiListener* listener = NULL, int fontId = 1, const char * _title = "");
|
||||
DeckEditorMenu(int id, JGuiListener* listener = NULL, int fontId = 1, const char * _title = "", DeckDataWrapper *selectedDeck = NULL, StatsWrapper *stats = NULL);
|
||||
void Render();
|
||||
~DeckEditorMenu();
|
||||
};
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "MTGDefinitions.h"
|
||||
using namespace std;
|
||||
|
||||
class Player;
|
||||
@@ -36,4 +38,52 @@ public:
|
||||
int nbGames();
|
||||
};
|
||||
|
||||
|
||||
class StatsWrapper {
|
||||
|
||||
public:
|
||||
|
||||
StatsWrapper( int deckId );
|
||||
~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[Constants::STATS_FOR_TURNS];
|
||||
float noCreaturesProbInTurn[Constants::STATS_FOR_TURNS];
|
||||
|
||||
int countCardsPerCost[Constants::STATS_MAX_MANA_COST+1];
|
||||
int countCardsPerCostAndColor[Constants::STATS_MAX_MANA_COST+1][Constants::MTG_NB_COLORS+1];
|
||||
int countCreaturesPerCost[Constants::STATS_MAX_MANA_COST+1];
|
||||
int countCreaturesPerCostAndColor[Constants::STATS_MAX_MANA_COST+1][Constants::MTG_NB_COLORS+1];
|
||||
int countSpellsPerCost[Constants::STATS_MAX_MANA_COST+1];
|
||||
int countSpellsPerCostAndColor[Constants::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;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -34,7 +34,11 @@ class Constants
|
||||
static const string kRetraceKeyword;
|
||||
static const string kKickerKeyword;
|
||||
|
||||
enum
|
||||
// used for deck statistics
|
||||
static const int STATS_FOR_TURNS = 8;
|
||||
static const int STATS_MAX_MANA_COST = 9;
|
||||
|
||||
enum
|
||||
{
|
||||
MTG_COLOR_ARTIFACT = 0,
|
||||
MTG_COLOR_GREEN = 1,
|
||||
|
||||
Reference in New Issue
Block a user