Just won my first Wagic network game :)

In details:
- I removed my player swap idea, it caused tons of issues with randoms
- instead I simply keep both peer on the exact same game and added one single parameter allowing to configure the view on the game. So, each peer is rendering the same game (gameObserver class) from a different player point of view (DuelLayers and related classes).
- a lot of gui stuff are missing to prevent user forbidden interactions but it works fine on Windows
This commit is contained in:
Xawotihs@gmail.com
2013-01-26 16:42:16 +00:00
parent db0f401ba5
commit f45c8e1d41
12 changed files with 112 additions and 94 deletions

View File

@@ -52,8 +52,8 @@ class GameObserver{
string startupGameSerialized;
bool parseLine(const string& s);
virtual void logAction(const string& s);
bool processAction(const string& s, bool swapPlayer = false);
bool processActions(bool undo, bool swapPlayer
bool processAction(const string& s);
bool processActions(bool undo
#ifdef TESTSUITE
, TestSuiteGame* testgame
#endif
@@ -143,7 +143,7 @@ class GameObserver{
logAction(players[playerId], s);
};
void logAction(MTGCardInstance* card, MTGGameZone* zone, size_t index, int result);
bool load(const string& s, bool undo = false, bool swapPlayers = false
bool load(const string& s, bool undo = false, int controlledPlayerIndex = 0
#ifdef TESTSUITE
, TestSuiteGame* testgame = 0
#endif
@@ -155,7 +155,7 @@ class GameObserver{
bool isStarted() { return (mLayers!=NULL);};
RandomGenerator* getRandomGenerator() { return &randomGenerator; };
WResourceManager* getResourceManager() { if(this) return mResourceManager;else return 0;};
CardSelectorBase* getCardSelector() { return mLayers->mCardSelector;};
CardSelectorBase* getCardSelector() { return mLayers->getCardSelector();};
bool operator==(const GameObserver& aGame);
JGE* getInput(){return mJGE;};
DeckManager* getDeckManager(){ return mDeckManager; };
@@ -180,6 +180,9 @@ class GameObserver{
return true;
}
};
DuelLayers *getView() { return mLayers; };
};
#ifdef NETWORK_SUPPORT