- reworked completly the JNetwork, JSocket interface (had to ifdef out the PSP socket code)
- added 2 menus to wait for connection and wait for deck selection - tested compilation on Qt Linux, Qt Windows and PSP - deactivated everywhere (NETWORK_SUPPORT to activate).
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
class AIMomirPlayer: public AIPlayerBaka
|
||||
{
|
||||
public:
|
||||
AIMomirPlayer(MTGDeck * deck, string file, string fileSmall, string avatarFile);
|
||||
AIMomirPlayer(string file, string fileSmall, string avatarFile, MTGDeck * deck = NULL);
|
||||
int getEfficiency(AIAction * action);
|
||||
int momir();
|
||||
int computeActions();
|
||||
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
int receiveEvent(WEvent * event);
|
||||
void Render();
|
||||
ManaCost * getPotentialMana(MTGCardInstance * card = NULL);
|
||||
AIPlayer(MTGDeck * deck, string deckFile, string deckFileSmall);
|
||||
AIPlayer(string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
|
||||
virtual ~AIPlayer();
|
||||
virtual MTGCardInstance * chooseCard(TargetChooser * tc, MTGCardInstance * source, int random = 0);
|
||||
virtual int chooseTarget(TargetChooser * tc = NULL, Player * forceTarget =NULL,MTGCardInstance * Choosencard = NULL);
|
||||
@@ -123,7 +123,7 @@ class AIPlayerBaka: public AIPlayer{
|
||||
MTGCardInstance * FindCardToPlay(ManaCost * potentialMana, const char * type);
|
||||
public:
|
||||
int deckId;
|
||||
AIPlayerBaka(MTGDeck * deck, string deckFile, string deckfileSmall, string avatarFile);
|
||||
AIPlayerBaka(string deckFile, string deckfileSmall, string avatarFile, MTGDeck * deck = NULL);
|
||||
virtual int Act(float dt);
|
||||
void initTimer();
|
||||
virtual int computeActions();
|
||||
|
||||
@@ -22,12 +22,18 @@
|
||||
#include "MTGGameZones.h"
|
||||
|
||||
#include "CardEffect.h"
|
||||
#ifdef NETWORK_SUPPORT
|
||||
#include "JNetwork.h"
|
||||
#endif //NETWORK_SUPPORT
|
||||
|
||||
enum
|
||||
{
|
||||
PLAYER_TYPE_CPU = 0,
|
||||
PLAYER_TYPE_HUMAN=1,
|
||||
PLAYER_TYPE_TESTSUITE=2
|
||||
PLAYER_TYPE_TESTSUITE=2,
|
||||
#ifdef NETWORK_SUPPORT
|
||||
PLAYER_TYPE_REMOTE=3
|
||||
#endif //NETWORK_SUPPORT
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -37,7 +43,10 @@ enum
|
||||
GAME_TYPE_RANDOM1,
|
||||
GAME_TYPE_RANDOM2,
|
||||
GAME_TYPE_STORY,
|
||||
GAME_TYPE_DEMO
|
||||
GAME_TYPE_DEMO,
|
||||
#ifdef NETWORK_SUPPORT
|
||||
GAME_TYPE_SLAVE,
|
||||
#endif //NETWORK_SUPPORT
|
||||
};
|
||||
|
||||
class MTGAllCards;
|
||||
@@ -61,6 +70,9 @@ public:
|
||||
|
||||
int gameType;
|
||||
CardEffect *effect;
|
||||
#ifdef NETWORK_SUPPORT
|
||||
JNetwork* mpNetwork;
|
||||
#endif //NETWORK_SUPPORT
|
||||
|
||||
GameApp();
|
||||
virtual ~GameApp();
|
||||
|
||||
@@ -15,6 +15,9 @@ class TestSuite;
|
||||
#endif
|
||||
class Credits;
|
||||
class Rules;
|
||||
#ifdef NETWORK_SUPPORT
|
||||
class JNetwork;
|
||||
#endif
|
||||
|
||||
class GameStateDuel: public GameState, public JGuiListener
|
||||
{
|
||||
@@ -22,6 +25,7 @@ private:
|
||||
#ifdef TESTSUITE
|
||||
TestSuite * testSuite;
|
||||
#endif
|
||||
|
||||
Credits * credits;
|
||||
int mGamePhase;
|
||||
Player * mCurrentPlayer;
|
||||
@@ -40,7 +44,7 @@ private:
|
||||
Rules * rules;
|
||||
|
||||
bool MusicExist(string FileName);
|
||||
void loadPlayer(int playerId, int decknb = 0, int isAI = 0);
|
||||
void loadPlayer(int playerId, int decknb = 0, bool isAI = false, bool isNetwork = false);
|
||||
void ConstructOpponentMenu(); //loads the opponentMenu if it doesn't exist
|
||||
void initScroller();
|
||||
|
||||
@@ -66,6 +70,10 @@ public:
|
||||
MENUITEM_MAIN_MENU = -13,
|
||||
MENUITEM_EVIL_TWIN = -14,
|
||||
MENUITEM_MULLIGAN = -15,
|
||||
#ifdef NETWORK_SUPPORT
|
||||
MENUITEM_REMOTE_CLIENT = -16,
|
||||
MENUITEM_REMOTE_SERVER = -17,
|
||||
#endif
|
||||
MENUITEM_MORE_INFO = kInfoMenuID
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef NETWORKPLAYER_H
|
||||
#define NETWORKPLAYER_H
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "Player.h"
|
||||
#include "JNetwork.h"
|
||||
|
||||
extern void RegisterNetworkPlayers();
|
||||
|
||||
class ProxyPlayer
|
||||
{
|
||||
protected:
|
||||
Player* mpPlayer;
|
||||
JNetwork* mpNetwork;
|
||||
static ProxyPlayer* mInstance;
|
||||
public:
|
||||
ProxyPlayer(Player* pxPlayer, JNetwork* pxNetwork);
|
||||
static void Serialize(istream& in, ostream& out);
|
||||
};
|
||||
|
||||
|
||||
class RemotePlayer : public Player
|
||||
{
|
||||
protected:
|
||||
JNetwork* mpNetwork;
|
||||
static RemotePlayer* mInstance;
|
||||
public:
|
||||
RemotePlayer(JNetwork*);
|
||||
static void Deserialize(istream& in, ostream& out);
|
||||
bool isLoaded() {return game!=NULL;};
|
||||
};
|
||||
|
||||
#endif // NETWORKPLAYER_H
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
string deckName;
|
||||
string phaseRing;
|
||||
|
||||
Player(MTGDeck * deck, string deckFile, string deckFileSmall);
|
||||
Player(string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
|
||||
virtual ~Player();
|
||||
|
||||
virtual void End();
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
class HumanPlayer: public Player
|
||||
{
|
||||
public:
|
||||
HumanPlayer(MTGDeck * deck, string deckFile, string deckFileSmall);
|
||||
HumanPlayer(string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
|
||||
HumanPlayer(string deckFile);
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user