Files
wagic/projects/mtg/include/DeckMetaData.h
techdragon.nguyen@gmail.com d9efb408e5 * optimized card loading. There was some redundant code that wasn't necessary.
* getCardByName seemed to have a initialization error if you tried to use it before the entire game loaded.  The cache would
throw an exception if you tried to use find and it was empty.  I put a guard around it to avoid this issue.

* refactored Zeth's "toggledifficuly" feature to be stored in meta data.  http://code.google.com/p/wagic/source/detail?r=3106
 -- This is slightly modified as it forces a 1 for 1 swap of cards that are specified.
    from the example given this is how it seemed to be used anyways.
 -- since all the information is stored in the meta data, there's no need to alter the deck's
    definition.
2011-02-14 08:14:35 +00:00

71 lines
1.3 KiB
C++

#ifndef _DECKMETADATA_H_
#define _DECKMETADATA_H_
#include <string>
#include <vector>
#include <map>
#include "DeckStats.h"
using namespace std;
enum DECK_DIFFICULTY
{
HARD = -1,
NORMAL = 0,
EASY = 1
};
class DeckMetaData
{
private:
string mFilename;
string mDescription;
string mName;
int mDeckId;
string mAvatarFilename;
string mColorIndex;
map<int,int> mAlternateCardMap;
// statistical information
int mGamesPlayed, mVictories, mPercentVictories, mDifficulty;
DeckMetaData();
public:
DeckMetaData(const string& filename);
void LoadDeck();
void LoadStats();
// Accessors
string getFilename();
string getDescription();
string getName();
string getAvatarFilename();
string getColorIndex();
int getAvatarId(int deckId);
string getStatsSummary();
map<int,int>& getAlternateMappings();
int getDeckId();
int getGamesPlayed();
int getVictories();
int getVictoryPercentage();
int getDifficulty();
string getDifficultyString();
// setters
void setColorIndex(const string& colorIndex);
void setDeckName( const string& newDeckTitle );
void Invalidate();
string mStatsFilename;
string mPlayerDeck;
bool mDeckLoaded;
bool mStatsLoaded;
bool mIsAI;
};
#endif