- Modified gameObserver and related classes to be able to work with a precise JGE instance given at construction and not the static global one. That allows to run gameObserver without JGE instance (for example in a worker thread).

- Added an "ACTION_LOGGING_TESTING" mode in the gameObserver. When this is defined, the game reloads itself in every update. I want to use that to track undo problems. Be aware that it kills performances and crashes with the testsuite if you want to activate it.
- Various cleanup/refactor of the game observer.
- Added a gameObserver == operator to compare two games
- Added player mode to the player serialization
- Added a multi-threaded mode to AI_CHANGE_TESTING. For the moment it's only useable with Qt. If you want to use it without, just defined a thread_count higher than 1.
- Refactored random generator class to use list intead of queue
- Defined a specific type for interrupt decision instead of int
This commit is contained in:
Xawotihs
2011-11-13 22:36:34 +00:00
parent 2240c14f56
commit f68c106e7e
33 changed files with 320 additions and 141 deletions

View File

@@ -34,10 +34,16 @@ class GameObserver{
// used when we're loading to know what to load
list<string> loadingList;
list<string>::iterator loadingite;
RandomGenerator randomGenerator;
WResourceManager* mResourceManager;
JGE* mJGE;
size_t updateCtr;
#ifdef ACTION_LOGGING_TESTING
GameObserver* oldGame;
#endif //ACTION_LOGGING_TESTING
int untap(MTGCardInstance * card);
bool WaitForExtraPayment(MTGCardInstance* card);
void initialize();
void cleanup();
string startupGameSerialized;
bool parseLine(const string& s);
@@ -47,8 +53,7 @@ class GameObserver{
bool mLoading;
void nextGamePhase();
void shuffleLibrary(Player* p);
RandomGenerator randomGenerator;
WResourceManager* mResourceManager;
void createPlayer(const string& playerMode);
public:
int currentPlayerId;
@@ -97,7 +102,7 @@ class GameObserver{
Player * isInterrupting;
Player * opponent();
Player * currentlyActing();
GameObserver(WResourceManager* resourceManager = NULL);
GameObserver(WResourceManager* output = 0, JGE* input = 0);
~GameObserver();
void gameStateBasedEffects();
void enchantmentStatus();
@@ -132,6 +137,9 @@ class GameObserver{
RandomGenerator* getRandomGenerator() { return &randomGenerator; };
WResourceManager* getResourceManager() { if(this) return mResourceManager;else return 0;};
CardSelectorBase* getCardSelector() { return mLayers->mCardSelector;};
bool operator==(const GameObserver& aGame);
JGE* getInput(){return mJGE;};
};
#endif