Files
wagic/projects/mtg/include/DeckManager.h
T
techdragon.nguyen@gmail.com ce7745bfa6 First attempt to reduce load time of player deck selection screens.
This change makes use of caching the DeckStats and DeckStatsWrappers into singleton caches that
get flushed when you quit the game.  The initial load time will be significant as lazy loading has not
been coded yet for the ai decks.

TODO: lazy load the player and ai decks as they appear on the screen.  Currently, each screen loads
all decks.
2011-01-27 16:13:40 +00:00

44 lines
1.3 KiB
C++

#include <string>
#include <vector>
#include "DeckMetaData.h"
using namespace std;
class DeckManager
{
private:
static bool instanceFlag;
static DeckManager *mInstance;
DeckManager()
{
//private constructor
}
public:
vector<DeckMetaData *> playerDeckOrderList;
vector<DeckMetaData *> aiDeckOrderList;
map<string, StatsWrapper *> playerDeckStatsMap;
map<string, StatsWrapper *> aiDeckStatsMap;
void updateMetaDataList(vector<DeckMetaData *>* refList, bool isAI);
vector<DeckMetaData *> * getPlayerDeckOrderList();
vector<DeckMetaData *> * getAIDeckOrderList();
DeckMetaData * getDeckMetaDataById( int deckId, bool isAI );
StatsWrapper * getExtendedStatsForDeckId( int deckId, MTGAllCards *collection, bool isAI );
StatsWrapper * getExtendedDeckStats( DeckMetaData *selectedDeck, MTGAllCards *collection, bool isAI );
static DeckManager * GetInstance();
static void EndInstance();
//convenience method to get the difficulty rating between two decks. This should be refined a little more
//since the eventual move of all deck meta data should be managed by this class
static int getDifficultyRating(Player *statsPlayer, Player *player);
~DeckManager();
};