Jeck - Added theme substyles, which are chosen dynamically based on the player's deck composition. Also added lazy unit test for booster packs, though there should be a better way to framework this.
This commit is contained in:
@@ -19,6 +19,10 @@ using std::string;
|
||||
|
||||
#define INVALID_OPTION -1
|
||||
|
||||
class WStyle;
|
||||
class StyleManager;
|
||||
class Player;
|
||||
|
||||
class Options {
|
||||
public:
|
||||
friend class GameSettings;
|
||||
@@ -44,6 +48,7 @@ public:
|
||||
MAX_GRADE,
|
||||
ECON_DIFFICULTY,
|
||||
TRANSITIONS,
|
||||
GUI_STYLE,
|
||||
INTERRUPT_SECONDS,
|
||||
KEY_BINDINGS,
|
||||
//My interrupts
|
||||
@@ -144,6 +149,8 @@ private:
|
||||
OptionVolume();
|
||||
static OptionVolume mDef;
|
||||
};
|
||||
|
||||
|
||||
class OptionClosedHand: public EnumDefinition {
|
||||
public:
|
||||
enum { INVISIBLE = 0, VISIBLE = 1 };
|
||||
@@ -183,7 +190,6 @@ private:
|
||||
OptionEconDifficulty();
|
||||
static OptionEconDifficulty mDef;
|
||||
};
|
||||
|
||||
class OptionDifficulty: public EnumDefinition {
|
||||
public:
|
||||
enum { NORMAL = 0, HARD = 1, HARDER = 2, EVIL = 3};
|
||||
@@ -243,9 +249,14 @@ public:
|
||||
|
||||
static GameOption invalid_option;
|
||||
|
||||
WStyle * getStyle();
|
||||
StyleManager * getStyleMan();
|
||||
void automaticStyle(Player * p1, Player * p2);
|
||||
|
||||
private:
|
||||
GameApp * theGame;
|
||||
SimplePad * keypad;
|
||||
StyleManager * styleMan;
|
||||
};
|
||||
|
||||
extern GameSettings options;
|
||||
|
||||
@@ -39,6 +39,9 @@ public:
|
||||
int maxInventory();
|
||||
void addToDeck(MTGDeck * d, WSrcCards * srcCards);
|
||||
string getSort();
|
||||
#ifdef TESTSUITE
|
||||
bool unitTest();
|
||||
#endif
|
||||
private:
|
||||
void randomCustom(MTGPacks * packlist);
|
||||
void randomStandard();
|
||||
|
||||
@@ -84,7 +84,13 @@ protected:
|
||||
vector<string> actual_data;
|
||||
};
|
||||
|
||||
|
||||
class OptionThemeStyle: public OptionSelect{
|
||||
public:
|
||||
virtual bool Visible();
|
||||
virtual void Reload();
|
||||
virtual void confirmChange(bool confirmed);
|
||||
OptionThemeStyle(string _displayValue);
|
||||
};
|
||||
class OptionDirectory:public OptionSelect{
|
||||
public:
|
||||
virtual void Reload();
|
||||
@@ -98,7 +104,7 @@ class OptionTheme:public OptionDirectory{
|
||||
private:
|
||||
static const string DIRTESTER;
|
||||
public:
|
||||
OptionTheme();
|
||||
OptionTheme(OptionThemeStyle * style = NULL);
|
||||
JQuad * getImage();
|
||||
virtual void updateValue();
|
||||
virtual float getHeight();
|
||||
@@ -107,6 +113,7 @@ class OptionTheme:public OptionDirectory{
|
||||
virtual bool Visible();
|
||||
|
||||
protected:
|
||||
OptionThemeStyle * ts;
|
||||
string author;
|
||||
bool bChecked;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
class WStyle{
|
||||
public:
|
||||
friend class StyleManager;
|
||||
string stylized(string filename);
|
||||
protected:
|
||||
map<string,string> mapping;
|
||||
};
|
||||
|
||||
class WStyleRule{
|
||||
public:
|
||||
string filter; //The condition
|
||||
string style; //The style to use.
|
||||
};
|
||||
class MTGDeck;
|
||||
class StyleManager{
|
||||
public:
|
||||
friend class OptionThemeStyle;
|
||||
friend class OptionTheme;
|
||||
StyleManager();
|
||||
~StyleManager();
|
||||
void determineActive(MTGDeck * p1, MTGDeck * p2);
|
||||
WStyle * get();
|
||||
protected:
|
||||
int topRule; int topSize;
|
||||
int playerSrc;
|
||||
|
||||
void loadRules();
|
||||
void killRules();
|
||||
vector<WStyleRule*> rules;
|
||||
string activeStyle;
|
||||
map<string,WStyle*> styles;
|
||||
};
|
||||
@@ -47,6 +47,12 @@ class TestSuiteState{
|
||||
void cleanup();
|
||||
};
|
||||
|
||||
|
||||
class TestSuitePregame{
|
||||
public:
|
||||
virtual void performTest() = 0;
|
||||
};
|
||||
|
||||
class TestSuite{
|
||||
public:
|
||||
MTGAllCards* collection;
|
||||
@@ -67,13 +73,14 @@ class TestSuite{
|
||||
int load(const char * filename);
|
||||
TestSuite(const char * filename,MTGAllCards* _collection);
|
||||
void initGame();
|
||||
void pregameTests();
|
||||
int assertGame();
|
||||
MTGPlayerCards * buildDeck(int playerId);
|
||||
string getNextAction();
|
||||
Interruptible * getActionByMTGId(int mtgid);
|
||||
int loadNext();
|
||||
void cleanup();
|
||||
int Log(const char * text);
|
||||
static int Log(const char * text);
|
||||
|
||||
};
|
||||
|
||||
@@ -85,7 +92,6 @@ class TestSuiteAI:public AIPlayerBaka{
|
||||
TestSuiteAI(TestSuite * suite, int playerId);
|
||||
virtual int Act(float dt);
|
||||
virtual int displayStack();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user