indent fixes tab = 4 chars
This commit is contained in:
+107
-107
@@ -28,142 +28,142 @@ class gameTableImpl;
|
|||||||
class ServerGuiWrapper : public GuiInterface
|
class ServerGuiWrapper : public GuiInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ServerGuiWrapper(ConfigFile *config, ClientCallback *clientcb, ServerCallback *servercb, IrcCallback *irccb);
|
ServerGuiWrapper(ConfigFile *config, ClientCallback *clientcb, ServerCallback *servercb, IrcCallback *irccb);
|
||||||
~ServerGuiWrapper();
|
~ServerGuiWrapper();
|
||||||
|
|
||||||
void initGui(int speed);
|
void initGui(int speed);
|
||||||
|
|
||||||
boost::shared_ptr<Session> getSession();
|
boost::shared_ptr<Session> getSession();
|
||||||
void setSession(boost::shared_ptr<Session> session);
|
void setSession(boost::shared_ptr<Session> session);
|
||||||
|
|
||||||
gameTableImpl* getMyW() const {return NULL;}
|
gameTableImpl* getMyW() const {return NULL;}
|
||||||
|
|
||||||
void refreshSet() const;
|
void refreshSet() const;
|
||||||
void refreshCash() const;
|
void refreshCash() const;
|
||||||
void refreshAction(int =-1, int =-1) const;
|
void refreshAction(int =-1, int =-1) const;
|
||||||
void refreshChangePlayer() const;
|
void refreshChangePlayer() const;
|
||||||
void refreshPot() const;
|
void refreshPot() const;
|
||||||
void refreshGroupbox(int =-1, int =-1) const;
|
void refreshGroupbox(int =-1, int =-1) const;
|
||||||
void refreshAll() const;
|
void refreshAll() const;
|
||||||
void refreshPlayerName() const;
|
void refreshPlayerName() const;
|
||||||
void refreshButton() const;
|
void refreshButton() const;
|
||||||
void refreshGameLabels(GameState state) const;
|
void refreshGameLabels(GameState state) const;
|
||||||
|
|
||||||
void setPlayerAvatar(int myUniqueID, const std::string &myAvatar) const;
|
void setPlayerAvatar(int myUniqueID, const std::string &myAvatar) const;
|
||||||
|
|
||||||
void waitForGuiUpdateDone() const;
|
void waitForGuiUpdateDone() const;
|
||||||
|
|
||||||
void dealBeRoCards(int);
|
void dealBeRoCards(int);
|
||||||
void dealHoleCards();
|
void dealHoleCards();
|
||||||
void dealFlopCards();
|
void dealFlopCards();
|
||||||
void dealTurnCard();
|
void dealTurnCard();
|
||||||
void dealRiverCard();
|
void dealRiverCard();
|
||||||
|
|
||||||
void nextPlayerAnimation();
|
void nextPlayerAnimation();
|
||||||
|
|
||||||
void beRoAnimation2(int);
|
void beRoAnimation2(int);
|
||||||
|
|
||||||
void preflopAnimation1();
|
void preflopAnimation1();
|
||||||
void preflopAnimation2();
|
void preflopAnimation2();
|
||||||
|
|
||||||
void flopAnimation1();
|
|
||||||
void flopAnimation2();
|
|
||||||
|
|
||||||
void turnAnimation1();
|
void flopAnimation1();
|
||||||
void turnAnimation2();
|
void flopAnimation2();
|
||||||
|
|
||||||
void riverAnimation1();
|
void turnAnimation1();
|
||||||
void riverAnimation2();
|
void turnAnimation2();
|
||||||
|
|
||||||
void postRiverAnimation1();
|
void riverAnimation1();
|
||||||
void postRiverRunAnimation1();
|
void riverAnimation2();
|
||||||
|
|
||||||
void flipHolecardsAllIn();
|
void postRiverAnimation1();
|
||||||
|
void postRiverRunAnimation1();
|
||||||
|
|
||||||
void nextRoundCleanGui();
|
void flipHolecardsAllIn();
|
||||||
|
|
||||||
void meInAction();
|
void nextRoundCleanGui();
|
||||||
void updateMyButtonsState();
|
|
||||||
void disableMyButtons();
|
|
||||||
void startTimeoutAnimation(int playerNum, int timeoutSec);
|
|
||||||
void stopTimeoutAnimation(int playerNum);
|
|
||||||
|
|
||||||
void startVoteOnKick(unsigned playerId, unsigned voteStarterPlayerId, int timeoutSec, int numVotesNeededToKick);
|
void meInAction();
|
||||||
void changeVoteOnKickButtonsState(bool showHide);
|
void updateMyButtonsState();
|
||||||
void refreshVotesMonitor(int currentVotes, int numVotesNeededToKick);
|
void disableMyButtons();
|
||||||
void endVoteOnKick();
|
void startTimeoutAnimation(int playerNum, int timeoutSec);
|
||||||
|
void stopTimeoutAnimation(int playerNum);
|
||||||
|
|
||||||
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
void startVoteOnKick(unsigned playerId, unsigned voteStarterPlayerId, int timeoutSec, int numVotesNeededToKick);
|
||||||
void logNewGameHandMsg(int gameID, int handID) ;
|
void changeVoteOnKickButtonsState(bool showHide);
|
||||||
void logPlayerWinsMsg(std::string playerName, int pot, bool main);
|
void refreshVotesMonitor(int currentVotes, int numVotesNeededToKick);
|
||||||
void logPlayerSitsOut(std::string playerName);
|
void endVoteOnKick();
|
||||||
void logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName);
|
|
||||||
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) ;
|
|
||||||
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") ;
|
|
||||||
void logPlayerWinGame(std::string playerName, int gameID);
|
|
||||||
void flushLogAtGame(int gameID);
|
|
||||||
void flushLogAtHand();
|
|
||||||
|
|
||||||
void SignalNetClientConnect(int actionID);
|
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
||||||
void SignalNetClientGameInfo(int actionID);
|
void logNewGameHandMsg(int gameID, int handID) ;
|
||||||
void SignalNetClientError(int errorID, int osErrorID);
|
void logPlayerWinsMsg(std::string playerName, int pot, bool main);
|
||||||
void SignalNetClientNotification(int notificationId);
|
void logPlayerSitsOut(std::string playerName);
|
||||||
void SignalNetClientStatsUpdate(const ServerStats &stats);
|
void logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName);
|
||||||
void SignalNetClientShowTimeoutDialog(NetTimeoutReason reason, unsigned remainingSec);
|
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) ;
|
||||||
void SignalNetClientRemovedFromGame(int notificationId);
|
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") ;
|
||||||
void SignalNetClientSelfJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin);
|
void logPlayerWinGame(std::string playerName, int gameID);
|
||||||
void SignalNetClientPlayerJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin);
|
void flushLogAtGame(int gameID);
|
||||||
void SignalNetClientPlayerChanged(unsigned playerId, const std::string &newPlayerName);
|
void flushLogAtHand();
|
||||||
void SignalNetClientPlayerLeft(unsigned playerId, const std::string &playerName, int removeReason);
|
|
||||||
void SignalNetClientNewGameAdmin(unsigned playerId, const std::string &playerName);
|
|
||||||
void SignalNetClientGameChatMsg(const std::string &playerName, const std::string &msg);
|
|
||||||
void SignalNetClientLobbyChatMsg(const std::string &playerName, const std::string &msg);
|
|
||||||
void SignalNetClientWaitDialog();
|
|
||||||
|
|
||||||
void SignalNetClientGameListNew(unsigned gameId);
|
void SignalNetClientConnect(int actionID);
|
||||||
void SignalNetClientGameListRemove(unsigned gameId);
|
void SignalNetClientGameInfo(int actionID);
|
||||||
void SignalNetClientGameListUpdateMode(unsigned gameId, GameMode mode);
|
void SignalNetClientError(int errorID, int osErrorID);
|
||||||
void SignalNetClientGameListUpdateAdmin(unsigned gameId, unsigned adminPlayerId);
|
void SignalNetClientNotification(int notificationId);
|
||||||
void SignalNetClientGameListPlayerJoined(unsigned gameId, unsigned playerId);
|
void SignalNetClientStatsUpdate(const ServerStats &stats);
|
||||||
void SignalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId);
|
void SignalNetClientShowTimeoutDialog(NetTimeoutReason reason, unsigned remainingSec);
|
||||||
void SignalNetClientGameStart(boost::shared_ptr<Game> game);
|
void SignalNetClientRemovedFromGame(int notificationId);
|
||||||
|
void SignalNetClientSelfJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin);
|
||||||
void SignalNetClientServerListAdd(unsigned serverId);
|
void SignalNetClientPlayerJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin);
|
||||||
void SignalNetClientServerListClear();
|
void SignalNetClientPlayerChanged(unsigned playerId, const std::string &newPlayerName);
|
||||||
void SignalNetClientServerListShow();
|
void SignalNetClientPlayerLeft(unsigned playerId, const std::string &playerName, int removeReason);
|
||||||
|
void SignalNetClientNewGameAdmin(unsigned playerId, const std::string &playerName);
|
||||||
|
void SignalNetClientGameChatMsg(const std::string &playerName, const std::string &msg);
|
||||||
|
void SignalNetClientLobbyChatMsg(const std::string &playerName, const std::string &msg);
|
||||||
|
void SignalNetClientWaitDialog();
|
||||||
|
|
||||||
void SignalNetClientLoginShow();
|
void SignalNetClientGameListNew(unsigned gameId);
|
||||||
|
void SignalNetClientGameListRemove(unsigned gameId);
|
||||||
|
void SignalNetClientGameListUpdateMode(unsigned gameId, GameMode mode);
|
||||||
|
void SignalNetClientGameListUpdateAdmin(unsigned gameId, unsigned adminPlayerId);
|
||||||
|
void SignalNetClientGameListPlayerJoined(unsigned gameId, unsigned playerId);
|
||||||
|
void SignalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId);
|
||||||
|
void SignalNetClientGameStart(boost::shared_ptr<Game> game);
|
||||||
|
|
||||||
void SignalNetServerSuccess(int actionID);
|
void SignalNetClientServerListAdd(unsigned serverId);
|
||||||
void SignalNetServerError(int errorID, int osErrorID);
|
void SignalNetClientServerListClear();
|
||||||
|
void SignalNetClientServerListShow();
|
||||||
|
|
||||||
void SignalIrcConnect(const std::string &server);
|
void SignalNetClientLoginShow();
|
||||||
void SignalIrcSelfJoined(const std::string &nickName, const std::string &channel);
|
|
||||||
void SignalIrcPlayerJoined(const std::string &nickName);
|
|
||||||
void SignalIrcPlayerChanged(const std::string &oldNick, const std::string &newNick);
|
|
||||||
void SignalIrcPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason);
|
|
||||||
void SignalIrcPlayerLeft(const std::string &nickName);
|
|
||||||
void SignalIrcChatMsg(const std::string &nickName, const std::string &msg);
|
|
||||||
void SignalNetClientMsgBox(const std::string &msg);
|
|
||||||
void SignalIrcError(int errorCode);
|
|
||||||
void SignalIrcServerError(int errorCode);
|
|
||||||
void SignalLobbyPlayerJoined(unsigned playerId, const std::string &nickName);
|
|
||||||
void SignalLobbyPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason);
|
|
||||||
void SignalLobbyPlayerLeft(unsigned playerId);
|
|
||||||
|
|
||||||
void SignalSelfGameInvitation(unsigned gameId, unsigned playerIdFrom);
|
void SignalNetServerSuccess(int actionID);
|
||||||
void SignalPlayerGameInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom);
|
void SignalNetServerError(int errorID, int osErrorID);
|
||||||
void SignalRejectedGameInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
|
|
||||||
|
void SignalIrcConnect(const std::string &server);
|
||||||
|
void SignalIrcSelfJoined(const std::string &nickName, const std::string &channel);
|
||||||
|
void SignalIrcPlayerJoined(const std::string &nickName);
|
||||||
|
void SignalIrcPlayerChanged(const std::string &oldNick, const std::string &newNick);
|
||||||
|
void SignalIrcPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason);
|
||||||
|
void SignalIrcPlayerLeft(const std::string &nickName);
|
||||||
|
void SignalIrcChatMsg(const std::string &nickName, const std::string &msg);
|
||||||
|
void SignalNetClientMsgBox(const std::string &msg);
|
||||||
|
void SignalIrcError(int errorCode);
|
||||||
|
void SignalIrcServerError(int errorCode);
|
||||||
|
void SignalLobbyPlayerJoined(unsigned playerId, const std::string &nickName);
|
||||||
|
void SignalLobbyPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason);
|
||||||
|
void SignalLobbyPlayerLeft(unsigned playerId);
|
||||||
|
|
||||||
|
void SignalSelfGameInvitation(unsigned gameId, unsigned playerIdFrom);
|
||||||
|
void SignalPlayerGameInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom);
|
||||||
|
void SignalRejectedGameInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
boost::shared_ptr<Session> mySession;
|
boost::shared_ptr<Session> mySession;
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
|
|
||||||
ClientCallback *myClientcb;
|
ClientCallback *myClientcb;
|
||||||
ServerCallback *myServercb;
|
ServerCallback *myServercb;
|
||||||
IrcCallback *myIrccb;
|
IrcCallback *myIrccb;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+60
-60
@@ -33,82 +33,82 @@ class gameTableImpl;
|
|||||||
|
|
||||||
class GuiInterface : public ClientCallback, public ServerCallback, public IrcCallback {
|
class GuiInterface : public ClientCallback, public ServerCallback, public IrcCallback {
|
||||||
public:
|
public:
|
||||||
virtual ~GuiInterface();
|
virtual ~GuiInterface();
|
||||||
|
|
||||||
virtual void initGui(int speed) =0;
|
virtual void initGui(int speed) =0;
|
||||||
|
|
||||||
virtual boost::shared_ptr<Session> getSession() =0;
|
virtual boost::shared_ptr<Session> getSession() =0;
|
||||||
virtual void setSession(boost::shared_ptr<Session> session) =0;
|
virtual void setSession(boost::shared_ptr<Session> session) =0;
|
||||||
|
|
||||||
virtual gameTableImpl *getMyW() const=0;
|
virtual gameTableImpl *getMyW() const=0;
|
||||||
|
|
||||||
//refresh-Funktionen
|
//refresh-Funktionen
|
||||||
virtual void refreshSet() const=0;
|
virtual void refreshSet() const=0;
|
||||||
virtual void refreshCash() const=0;
|
virtual void refreshCash() const=0;
|
||||||
virtual void refreshAction(int =-1, int =-1) const=0;
|
virtual void refreshAction(int =-1, int =-1) const=0;
|
||||||
virtual void refreshChangePlayer() const=0;
|
virtual void refreshChangePlayer() const=0;
|
||||||
virtual void refreshPot() const=0;
|
virtual void refreshPot() const=0;
|
||||||
virtual void refreshGroupbox(int =-1, int =-1) const=0;
|
virtual void refreshGroupbox(int =-1, int =-1) const=0;
|
||||||
virtual void refreshAll() const=0;
|
virtual void refreshAll() const=0;
|
||||||
virtual void refreshPlayerName() const=0;
|
virtual void refreshPlayerName() const=0;
|
||||||
virtual void refreshButton() const =0;
|
virtual void refreshButton() const =0;
|
||||||
virtual void refreshGameLabels(GameState state) const=0;
|
virtual void refreshGameLabels(GameState state) const=0;
|
||||||
|
|
||||||
virtual void setPlayerAvatar(int myUniqueID, const std::string &myAvatar) const=0;
|
|
||||||
virtual void waitForGuiUpdateDone() const=0;
|
|
||||||
|
|
||||||
// Karten-Funktionen
|
virtual void setPlayerAvatar(int myUniqueID, const std::string &myAvatar) const=0;
|
||||||
virtual void dealBeRoCards(int) =0;
|
virtual void waitForGuiUpdateDone() const=0;
|
||||||
virtual void dealHoleCards()=0;
|
|
||||||
virtual void dealFlopCards()=0;
|
|
||||||
virtual void dealTurnCard()=0;
|
|
||||||
virtual void dealRiverCard()=0;
|
|
||||||
|
|
||||||
virtual void nextPlayerAnimation()=0;
|
// Karten-Funktionen
|
||||||
|
virtual void dealBeRoCards(int) =0;
|
||||||
|
virtual void dealHoleCards()=0;
|
||||||
|
virtual void dealFlopCards()=0;
|
||||||
|
virtual void dealTurnCard()=0;
|
||||||
|
virtual void dealRiverCard()=0;
|
||||||
|
|
||||||
virtual void beRoAnimation2(int)=0;
|
virtual void nextPlayerAnimation()=0;
|
||||||
|
|
||||||
virtual void preflopAnimation1()=0;
|
virtual void beRoAnimation2(int)=0;
|
||||||
virtual void preflopAnimation2()=0;
|
|
||||||
|
|
||||||
virtual void flopAnimation1()=0;
|
virtual void preflopAnimation1()=0;
|
||||||
virtual void flopAnimation2()=0;
|
virtual void preflopAnimation2()=0;
|
||||||
|
|
||||||
virtual void turnAnimation1()=0;
|
virtual void flopAnimation1()=0;
|
||||||
virtual void turnAnimation2()=0;
|
virtual void flopAnimation2()=0;
|
||||||
|
|
||||||
virtual void riverAnimation1()=0;
|
virtual void turnAnimation1()=0;
|
||||||
virtual void riverAnimation2()=0;
|
virtual void turnAnimation2()=0;
|
||||||
|
|
||||||
virtual void postRiverAnimation1()=0;
|
virtual void riverAnimation1()=0;
|
||||||
virtual void postRiverRunAnimation1()=0;
|
virtual void riverAnimation2()=0;
|
||||||
virtual void flipHolecardsAllIn()=0;
|
|
||||||
|
|
||||||
virtual void nextRoundCleanGui()=0;
|
virtual void postRiverAnimation1()=0;
|
||||||
virtual void meInAction()=0;
|
virtual void postRiverRunAnimation1()=0;
|
||||||
virtual void updateMyButtonsState()=0;
|
virtual void flipHolecardsAllIn()=0;
|
||||||
virtual void disableMyButtons()=0;
|
|
||||||
virtual void startTimeoutAnimation(int playerNum, int timeoutSec) =0;
|
|
||||||
virtual void stopTimeoutAnimation(int playerNum) =0;
|
|
||||||
|
|
||||||
virtual void startVoteOnKick(unsigned playerId, unsigned voteStarterPlayerId, int timeoutSec, int numVotesNeededToKick) =0;
|
virtual void nextRoundCleanGui()=0;
|
||||||
virtual void changeVoteOnKickButtonsState(bool showHide) =0;
|
virtual void meInAction()=0;
|
||||||
virtual void refreshVotesMonitor(int currentVotes, int numVotesNeededToKick) =0;
|
virtual void updateMyButtonsState()=0;
|
||||||
virtual void endVoteOnKick() =0;
|
virtual void disableMyButtons()=0;
|
||||||
|
virtual void startTimeoutAnimation(int playerNum, int timeoutSec) =0;
|
||||||
|
virtual void stopTimeoutAnimation(int playerNum) =0;
|
||||||
|
|
||||||
|
virtual void startVoteOnKick(unsigned playerId, unsigned voteStarterPlayerId, int timeoutSec, int numVotesNeededToKick) =0;
|
||||||
|
virtual void changeVoteOnKickButtonsState(bool showHide) =0;
|
||||||
|
virtual void refreshVotesMonitor(int currentVotes, int numVotesNeededToKick) =0;
|
||||||
|
virtual void endVoteOnKick() =0;
|
||||||
|
|
||||||
|
//log.cpp
|
||||||
|
virtual void logPlayerActionMsg(std::string playName, int action, int setValue) =0;
|
||||||
|
virtual void logNewGameHandMsg(int gameID, int HandID) =0;
|
||||||
|
virtual void logPlayerWinsMsg(std::string playerName, int pot, bool main) = 0;
|
||||||
|
virtual void logPlayerSitsOut(std::string playerName) = 0;
|
||||||
|
virtual void logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName) =0;
|
||||||
|
virtual void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) = 0;
|
||||||
|
virtual void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") = 0;
|
||||||
|
virtual void logPlayerWinGame(std::string playerName, int gameID) =0;
|
||||||
|
virtual void flushLogAtGame(int gameID) =0;
|
||||||
|
virtual void flushLogAtHand() =0;
|
||||||
|
|
||||||
//log.cpp
|
|
||||||
virtual void logPlayerActionMsg(std::string playName, int action, int setValue) =0;
|
|
||||||
virtual void logNewGameHandMsg(int gameID, int HandID) =0;
|
|
||||||
virtual void logPlayerWinsMsg(std::string playerName, int pot, bool main) = 0;
|
|
||||||
virtual void logPlayerSitsOut(std::string playerName) = 0;
|
|
||||||
virtual void logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName) =0;
|
|
||||||
virtual void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) = 0;
|
|
||||||
virtual void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") = 0;
|
|
||||||
virtual void logPlayerWinGame(std::string playerName, int gameID) =0;
|
|
||||||
virtual void flushLogAtGame(int gameID) =0;
|
|
||||||
virtual void flushLogAtHand() =0;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -35,120 +35,120 @@ class MyGameListSortFilterProxyModel;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class gameLobbyDialogImpl: public QDialog, public Ui::gameLobbyDialog {
|
class gameLobbyDialogImpl: public QDialog, public Ui::gameLobbyDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
gameLobbyDialogImpl(startWindowImpl *parent = 0, ConfigFile* = 0);
|
gameLobbyDialogImpl(startWindowImpl *parent = 0, ConfigFile* = 0);
|
||||||
|
|
||||||
~gameLobbyDialogImpl();
|
~gameLobbyDialogImpl();
|
||||||
|
|
||||||
void exec();
|
void exec();
|
||||||
|
|
||||||
ChatTools *getMyChat() { return myChat; }
|
ChatTools *getMyChat() { return myChat; }
|
||||||
|
|
||||||
void setSession(boost::shared_ptr<Session> session);
|
void setSession(boost::shared_ptr<Session> session);
|
||||||
boost::shared_ptr<Session> getSession() { assert(mySession.get()); return mySession; }
|
boost::shared_ptr<Session> getSession() { assert(mySession.get()); return mySession; }
|
||||||
|
|
||||||
void setMyW ( gameTableImpl* theValue ) { myW = theValue; }
|
void setMyW ( gameTableImpl* theValue ) { myW = theValue; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void createGame();
|
void createGame();
|
||||||
void joinGame();
|
void joinGame();
|
||||||
void joinAnyGame();
|
void joinAnyGame();
|
||||||
void gameSelected(const QModelIndex &, const QModelIndex &);
|
void gameSelected(const QModelIndex &, const QModelIndex &);
|
||||||
void updateGameItem(QList <QStandardItem*>, unsigned gameId);
|
void updateGameItem(QList <QStandardItem*>, unsigned gameId);
|
||||||
void addGame(unsigned gameId);
|
void addGame(unsigned gameId);
|
||||||
void updateGameMode(unsigned gameId, int newMode);
|
void updateGameMode(unsigned gameId, int newMode);
|
||||||
void updateGameAdmin(unsigned gameId, unsigned adminPlayerId);
|
void updateGameAdmin(unsigned gameId, unsigned adminPlayerId);
|
||||||
void removeGame(unsigned gameId);
|
void removeGame(unsigned gameId);
|
||||||
void gameAddPlayer(unsigned gameId, unsigned playerId);
|
void gameAddPlayer(unsigned gameId, unsigned playerId);
|
||||||
void gameRemovePlayer(unsigned gameId, unsigned playerId);
|
void gameRemovePlayer(unsigned gameId, unsigned playerId);
|
||||||
void playerJoinedLobby(unsigned playerId, QString playerName);
|
void playerJoinedLobby(unsigned playerId, QString playerName);
|
||||||
void playerLeftLobby(unsigned playerId);
|
void playerLeftLobby(unsigned playerId);
|
||||||
void updateStats(ServerStats stats);
|
void updateStats(ServerStats stats);
|
||||||
void refreshGameStats();
|
void refreshGameStats();
|
||||||
void refreshPlayerStats();
|
void refreshPlayerStats();
|
||||||
void setCurrentGameName ( const QString& theValue ) { currentGameName = theValue; }
|
void setCurrentGameName ( const QString& theValue ) { currentGameName = theValue; }
|
||||||
QString getCurrentGameName() const { return currentGameName; }
|
QString getCurrentGameName() const { return currentGameName; }
|
||||||
gameTableImpl* getMyW() const { return myW; }
|
gameTableImpl* getMyW() const { return myW; }
|
||||||
void checkPlayerQuantity();
|
void checkPlayerQuantity();
|
||||||
void blinkingStartButtonAnimation();
|
void blinkingStartButtonAnimation();
|
||||||
void joinedNetworkGame(unsigned, QString, bool);
|
void joinedNetworkGame(unsigned, QString, bool);
|
||||||
void addConnectedPlayer(unsigned, QString, bool);
|
void addConnectedPlayer(unsigned, QString, bool);
|
||||||
void updatePlayer(unsigned, QString);
|
void updatePlayer(unsigned, QString);
|
||||||
void removePlayer(unsigned, QString);
|
void removePlayer(unsigned, QString);
|
||||||
void newGameAdmin(unsigned, QString);
|
void newGameAdmin(unsigned, QString);
|
||||||
void refreshConnectedPlayerAvatars();
|
void refreshConnectedPlayerAvatars();
|
||||||
void playerSelected(QTreeWidgetItem*, QTreeWidgetItem*);
|
void playerSelected(QTreeWidgetItem*, QTreeWidgetItem*);
|
||||||
void refresh(int actionID);
|
void refresh(int actionID);
|
||||||
void removedFromGame(int reason);
|
void removedFromGame(int reason);
|
||||||
void startGame();
|
void startGame();
|
||||||
void leaveGame();
|
void leaveGame();
|
||||||
void kickPlayer();
|
void kickPlayer();
|
||||||
void joinedGameDialogUpdate();
|
void joinedGameDialogUpdate();
|
||||||
void leftGameDialogUpdate();
|
void leftGameDialogUpdate();
|
||||||
void updateDialogBlinds(const GameData &gameData);
|
void updateDialogBlinds(const GameData &gameData);
|
||||||
void clearDialog();
|
void clearDialog();
|
||||||
void keyPressEvent(QKeyEvent * keyEvent);
|
void keyPressEvent(QKeyEvent * keyEvent);
|
||||||
bool event(QEvent * event);
|
bool event(QEvent * event);
|
||||||
void hideShowGameDescription(bool show);
|
void hideShowGameDescription(bool show);
|
||||||
void showWaitStartGameMsgBox();
|
void showWaitStartGameMsgBox();
|
||||||
void joinAnyGameButtonRefresh();
|
void joinAnyGameButtonRefresh();
|
||||||
void reject();
|
void reject();
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
void writeDialogSettings(int);
|
void writeDialogSettings(int);
|
||||||
void readDialogSettings();
|
void readDialogSettings();
|
||||||
void changeGameListFilter(int);
|
void changeGameListFilter(int);
|
||||||
void changeGameListSorting();
|
void changeGameListSorting();
|
||||||
void registeredUserMode();
|
void registeredUserMode();
|
||||||
void guestUserMode();
|
void guestUserMode();
|
||||||
void showNickListContextMenu(QPoint);
|
void showNickListContextMenu(QPoint);
|
||||||
void invitePlayerToCurrentGame();
|
void invitePlayerToCurrentGame();
|
||||||
void showInfoMsgBox();
|
void showInfoMsgBox();
|
||||||
void showInvitationDialog(unsigned gameId, unsigned playerIdFrom);
|
void showInvitationDialog(unsigned gameId, unsigned playerIdFrom);
|
||||||
void chatInfoPlayerInviation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom);
|
void chatInfoPlayerInviation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom);
|
||||||
void chatInfoPlayerRejectedInviation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
|
void chatInfoPlayerRejectedInviation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
gameTableImpl* myW;
|
|
||||||
startWindowImpl* myStartWindow;
|
|
||||||
ConfigFile *myConfig;
|
|
||||||
boost::shared_ptr<Session> mySession;
|
|
||||||
createInternetGameDialogImpl *myCreateInternetGameDialog;
|
|
||||||
QString currentGameName;
|
|
||||||
unsigned myPlayerId;
|
|
||||||
unsigned myCurrentGameId;
|
|
||||||
bool isGameAdministrator;
|
|
||||||
bool inGame;
|
|
||||||
bool guestMode;
|
|
||||||
|
|
||||||
QString myAppDataPath;
|
gameTableImpl* myW;
|
||||||
QMessageBox *waitStartGameMsgBox;
|
startWindowImpl* myStartWindow;
|
||||||
QTimer *waitStartGameMsgBoxTimer;
|
ConfigFile *myConfig;
|
||||||
QTimer *blinkingButtonAnimationTimer;
|
boost::shared_ptr<Session> mySession;
|
||||||
QTimer *showInfoMsgBoxTimer;
|
createInternetGameDialogImpl *myCreateInternetGameDialog;
|
||||||
bool blinkingButtonAnimationState;
|
QString currentGameName;
|
||||||
QColor defaultStartButtonColor;
|
unsigned myPlayerId;
|
||||||
QColor defaultStartButtonTextColor;
|
unsigned myCurrentGameId;
|
||||||
QColor disabledStartButtonColor;
|
bool isGameAdministrator;
|
||||||
QColor disabledStartButtonTextColor;
|
bool inGame;
|
||||||
ChatTools *myChat;
|
bool guestMode;
|
||||||
int keyUpCounter;
|
|
||||||
QStandardItemModel *myGameListModel;
|
QString myAppDataPath;
|
||||||
QItemSelectionModel *myGameListSelectionModel;
|
QMessageBox *waitStartGameMsgBox;
|
||||||
MyGameListSortFilterProxyModel *myGameListSortFilterProxyModel;
|
QTimer *waitStartGameMsgBoxTimer;
|
||||||
QMenu *nickListContextMenu;
|
QTimer *blinkingButtonAnimationTimer;
|
||||||
QAction *nickListInviteAction;
|
QTimer *showInfoMsgBoxTimer;
|
||||||
QAction *ignorePlayerAction;
|
bool blinkingButtonAnimationState;
|
||||||
int infoMsgToShowId;
|
QColor defaultStartButtonColor;
|
||||||
int currentInvitationGameId;
|
QColor defaultStartButtonTextColor;
|
||||||
bool inviteDialogIsCurrentlyShown;
|
QColor disabledStartButtonColor;
|
||||||
|
QColor disabledStartButtonTextColor;
|
||||||
|
ChatTools *myChat;
|
||||||
|
int keyUpCounter;
|
||||||
|
QStandardItemModel *myGameListModel;
|
||||||
|
QItemSelectionModel *myGameListSelectionModel;
|
||||||
|
MyGameListSortFilterProxyModel *myGameListSortFilterProxyModel;
|
||||||
|
QMenu *nickListContextMenu;
|
||||||
|
QAction *nickListInviteAction;
|
||||||
|
QAction *ignorePlayerAction;
|
||||||
|
int infoMsgToShowId;
|
||||||
|
int currentInvitationGameId;
|
||||||
|
bool inviteDialogIsCurrentlyShown;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool eventFilter(QObject *obj, QEvent *event);
|
||||||
|
|
||||||
protected:
|
|
||||||
bool eventFilter(QObject *obj, QEvent *event);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+22
-17
@@ -34,10 +34,10 @@ GuiWrapper::GuiWrapper(ConfigFile *c, startWindowImpl *s) : myLog(NULL), myW(NUL
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
myW = new gameTableImpl(myConfig);
|
myW = new gameTableImpl(myConfig);
|
||||||
myLog = new Log(myW, myConfig);
|
myLog = new Log(myW, myConfig);
|
||||||
|
|
||||||
myW->setStartWindow(myStartWindow);
|
myW->setStartWindow(myStartWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -66,8 +66,8 @@ void GuiWrapper::setPlayerAvatar(int myUniqueID, const std::string &myAvatar) co
|
|||||||
|
|
||||||
void GuiWrapper::waitForGuiUpdateDone() const
|
void GuiWrapper::waitForGuiUpdateDone() const
|
||||||
{
|
{
|
||||||
myW->signalGuiUpdateDone();
|
myW->signalGuiUpdateDone();
|
||||||
myW->waitForGuiUpdateDone();
|
myW->waitForGuiUpdateDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiWrapper::dealBeRoCards(int myBeRoID) { myW->signalDealBeRoCards(myBeRoID); }
|
void GuiWrapper::dealBeRoCards(int myBeRoID) { myW->signalDealBeRoCards(myBeRoID); }
|
||||||
@@ -138,21 +138,21 @@ void GuiWrapper::SignalNetClientSelfJoined(unsigned playerId, const string &play
|
|||||||
void GuiWrapper::SignalNetClientPlayerJoined(unsigned playerId, const string &playerName, bool isGameAdmin) { myStartWindow->signalNetClientPlayerJoined(playerId, QString::fromUtf8(playerName.c_str()), isGameAdmin); }
|
void GuiWrapper::SignalNetClientPlayerJoined(unsigned playerId, const string &playerName, bool isGameAdmin) { myStartWindow->signalNetClientPlayerJoined(playerId, QString::fromUtf8(playerName.c_str()), isGameAdmin); }
|
||||||
void GuiWrapper::SignalNetClientPlayerChanged(unsigned playerId, const string &newPlayerName)
|
void GuiWrapper::SignalNetClientPlayerChanged(unsigned playerId, const string &newPlayerName)
|
||||||
{
|
{
|
||||||
myStartWindow->signalNetClientPlayerChanged(playerId, QString::fromUtf8(newPlayerName.c_str()));
|
myStartWindow->signalNetClientPlayerChanged(playerId, QString::fromUtf8(newPlayerName.c_str()));
|
||||||
}
|
}
|
||||||
void GuiWrapper::SignalNetClientPlayerLeft(unsigned playerId, const string &playerName, int removeReason)
|
void GuiWrapper::SignalNetClientPlayerLeft(unsigned playerId, const string &playerName, int removeReason)
|
||||||
{
|
{
|
||||||
QString tmpName(QString::fromUtf8(playerName.c_str()));
|
QString tmpName(QString::fromUtf8(playerName.c_str()));
|
||||||
myStartWindow->signalNetClientPlayerLeft(playerId, tmpName);
|
myStartWindow->signalNetClientPlayerLeft(playerId, tmpName);
|
||||||
myW->signalNetClientPlayerLeft(playerId);
|
myW->signalNetClientPlayerLeft(playerId);
|
||||||
if (!playerName.empty() && playerName[0] != '#')
|
if (!playerName.empty() && playerName[0] != '#')
|
||||||
myLog->signalLogPlayerLeftMsg(tmpName, removeReason == NTF_NET_REMOVED_KICKED);
|
myLog->signalLogPlayerLeftMsg(tmpName, removeReason == NTF_NET_REMOVED_KICKED);
|
||||||
}
|
}
|
||||||
void GuiWrapper::SignalNetClientNewGameAdmin(unsigned playerId, const string &playerName) {
|
void GuiWrapper::SignalNetClientNewGameAdmin(unsigned playerId, const string &playerName) {
|
||||||
|
|
||||||
myStartWindow->signalNetClientNewGameAdmin(playerId, QString::fromUtf8(playerName.c_str()));
|
myStartWindow->signalNetClientNewGameAdmin(playerId, QString::fromUtf8(playerName.c_str()));
|
||||||
if (!playerName.empty() && playerName[0] != '#')
|
if (!playerName.empty() && playerName[0] != '#')
|
||||||
myLog->signalLogNewGameAdminMsg(QString::fromUtf8(playerName.c_str()));
|
myLog->signalLogNewGameAdminMsg(QString::fromUtf8(playerName.c_str()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,6 +186,11 @@ void GuiWrapper::SignalLobbyPlayerJoined(unsigned playerId, const string &nickNa
|
|||||||
void GuiWrapper::SignalLobbyPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason) { myStartWindow->signalLobbyPlayerKicked(QString::fromUtf8(nickName.c_str()), QString::fromUtf8(byWhom.c_str()), QString::fromUtf8(reason.c_str())); }
|
void GuiWrapper::SignalLobbyPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason) { myStartWindow->signalLobbyPlayerKicked(QString::fromUtf8(nickName.c_str()), QString::fromUtf8(byWhom.c_str()), QString::fromUtf8(reason.c_str())); }
|
||||||
void GuiWrapper::SignalLobbyPlayerLeft(unsigned playerId) { myStartWindow->signalLobbyPlayerLeft(playerId); }
|
void GuiWrapper::SignalLobbyPlayerLeft(unsigned playerId) { myStartWindow->signalLobbyPlayerLeft(playerId); }
|
||||||
|
|
||||||
void GuiWrapper::SignalSelfGameInvitation(unsigned gameId, unsigned playerIdFrom) { myStartWindow->signalSelfGameInvitation(gameId, playerIdFrom); }
|
void GuiWrapper::SignalSelfGameInvitation(unsigned gameId, unsigned
|
||||||
void GuiWrapper::SignalPlayerGameInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom) { myStartWindow->signalPlayerGameInvitation(gameId, playerIdWho, playerIdFrom); }
|
playerIdFrom) { myStartWindow->signalSelfGameInvitation(gameId, playerIdFrom);
|
||||||
void GuiWrapper::SignalRejectedGameInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason) { myStartWindow->signalRejectedGameInvitation(gameId, playerIdWho, reason); }
|
} void GuiWrapper::SignalPlayerGameInvitation(unsigned gameId, unsigned
|
||||||
|
playerIdWho, unsigned playerIdFrom) {
|
||||||
|
myStartWindow->signalPlayerGameInvitation(gameId, playerIdWho, playerIdFrom); }
|
||||||
|
void GuiWrapper::SignalRejectedGameInvitation(unsigned gameId, unsigned
|
||||||
|
playerIdWho, DenyGameInvitationReason reason) {
|
||||||
|
myStartWindow->signalRejectedGameInvitation(gameId, playerIdWho, reason); }
|
||||||
|
|||||||
+107
-107
@@ -34,139 +34,139 @@ class ConfigFile;
|
|||||||
class GuiWrapper : public GuiInterface
|
class GuiWrapper : public GuiInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GuiWrapper(ConfigFile*, startWindowImpl*);
|
GuiWrapper(ConfigFile*, startWindowImpl*);
|
||||||
|
|
||||||
~GuiWrapper();
|
~GuiWrapper();
|
||||||
|
|
||||||
void initGui(int speed);
|
void initGui(int speed);
|
||||||
|
|
||||||
boost::shared_ptr<Session> getSession();
|
boost::shared_ptr<Session> getSession();
|
||||||
void setSession(boost::shared_ptr<Session> session);
|
void setSession(boost::shared_ptr<Session> session);
|
||||||
|
|
||||||
gameTableImpl* getMyW() const { return myW; }
|
gameTableImpl* getMyW() const { return myW; }
|
||||||
|
|
||||||
void refreshSet() const;
|
|
||||||
void refreshCash() const;
|
|
||||||
void refreshAction(int =-1, int =-1) const;
|
|
||||||
void refreshChangePlayer() const;
|
|
||||||
void refreshPot() const;
|
|
||||||
void refreshGroupbox(int =-1, int =-1) const;
|
|
||||||
void refreshAll() const;
|
|
||||||
void refreshPlayerName() const;
|
|
||||||
void refreshButton() const;
|
|
||||||
void refreshGameLabels(GameState state) const;
|
|
||||||
|
|
||||||
void setPlayerAvatar(int myUniqueID, const std::string &myAvatar) const;
|
void refreshSet() const;
|
||||||
|
void refreshCash() const;
|
||||||
|
void refreshAction(int =-1, int =-1) const;
|
||||||
|
void refreshChangePlayer() const;
|
||||||
|
void refreshPot() const;
|
||||||
|
void refreshGroupbox(int =-1, int =-1) const;
|
||||||
|
void refreshAll() const;
|
||||||
|
void refreshPlayerName() const;
|
||||||
|
void refreshButton() const;
|
||||||
|
void refreshGameLabels(GameState state) const;
|
||||||
|
|
||||||
void waitForGuiUpdateDone() const;
|
void setPlayerAvatar(int myUniqueID, const std::string &myAvatar) const;
|
||||||
|
|
||||||
void dealBeRoCards(int myBeRoID);
|
void waitForGuiUpdateDone() const;
|
||||||
void dealHoleCards();
|
|
||||||
void dealFlopCards();
|
|
||||||
void dealTurnCard();
|
|
||||||
void dealRiverCard();
|
|
||||||
|
|
||||||
void nextPlayerAnimation();
|
void dealBeRoCards(int myBeRoID);
|
||||||
|
void dealHoleCards();
|
||||||
|
void dealFlopCards();
|
||||||
|
void dealTurnCard();
|
||||||
|
void dealRiverCard();
|
||||||
|
|
||||||
void beRoAnimation2(int);
|
void nextPlayerAnimation();
|
||||||
|
|
||||||
void preflopAnimation1();
|
|
||||||
void preflopAnimation2();
|
|
||||||
|
|
||||||
void flopAnimation1();
|
|
||||||
void flopAnimation2();
|
|
||||||
|
|
||||||
void turnAnimation1();
|
void beRoAnimation2(int);
|
||||||
void turnAnimation2();
|
|
||||||
|
|
||||||
void riverAnimation1();
|
void preflopAnimation1();
|
||||||
void riverAnimation2();
|
void preflopAnimation2();
|
||||||
|
|
||||||
void postRiverAnimation1();
|
void flopAnimation1();
|
||||||
void postRiverRunAnimation1();
|
void flopAnimation2();
|
||||||
|
|
||||||
void flipHolecardsAllIn();
|
void turnAnimation1();
|
||||||
|
void turnAnimation2();
|
||||||
|
|
||||||
void nextRoundCleanGui();
|
void riverAnimation1();
|
||||||
|
void riverAnimation2();
|
||||||
|
|
||||||
void meInAction();
|
void postRiverAnimation1();
|
||||||
void disableMyButtons();
|
void postRiverRunAnimation1();
|
||||||
void updateMyButtonsState();
|
|
||||||
void startTimeoutAnimation(int playerNum, int timeoutSec);
|
|
||||||
void stopTimeoutAnimation(int playerNum);
|
|
||||||
|
|
||||||
void startVoteOnKick(unsigned playerId, unsigned voteStarterPlayerId, int timeoutSec, int numVotesNeededToKick);
|
void flipHolecardsAllIn();
|
||||||
void changeVoteOnKickButtonsState(bool showHide);
|
|
||||||
void refreshVotesMonitor(int currentVotes, int numVotesNeededToKick);
|
|
||||||
void endVoteOnKick();
|
|
||||||
|
|
||||||
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
void nextRoundCleanGui();
|
||||||
void logNewGameHandMsg(int gameID, int handID) ;
|
|
||||||
void logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName);
|
|
||||||
void logPlayerWinsMsg(std::string playerName, int pot, bool main);
|
|
||||||
void logPlayerSitsOut(std::string playerName);
|
|
||||||
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1);
|
|
||||||
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows");
|
|
||||||
void logPlayerWinGame(std::string playerName, int gameID);
|
|
||||||
void flushLogAtGame(int gameID);
|
|
||||||
void flushLogAtHand();
|
|
||||||
|
|
||||||
void SignalNetClientConnect(int actionID);
|
void meInAction();
|
||||||
void SignalNetClientServerListAdd(unsigned serverId);
|
void disableMyButtons();
|
||||||
void SignalNetClientServerListShow();
|
void updateMyButtonsState();
|
||||||
void SignalNetClientServerListClear();
|
void startTimeoutAnimation(int playerNum, int timeoutSec);
|
||||||
void SignalNetClientLoginShow();
|
void stopTimeoutAnimation(int playerNum);
|
||||||
void SignalNetClientGameInfo(int actionID);
|
|
||||||
void SignalNetClientError(int errorID, int osErrorID);
|
|
||||||
void SignalNetClientNotification(int notificationId);
|
|
||||||
void SignalNetClientStatsUpdate(const ServerStats &stats);
|
|
||||||
void SignalNetClientShowTimeoutDialog(NetTimeoutReason reason, unsigned remainingSec);
|
|
||||||
void SignalNetClientRemovedFromGame(int notificationId);
|
|
||||||
void SignalNetClientSelfJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin);
|
|
||||||
void SignalNetClientPlayerJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin);
|
|
||||||
void SignalNetClientPlayerChanged(unsigned playerId, const std::string &newPlayerName);
|
|
||||||
void SignalNetClientPlayerLeft(unsigned playerId, const std::string &playerName, int removeReason);
|
|
||||||
void SignalNetClientNewGameAdmin(unsigned playerId, const std::string &playerName);
|
|
||||||
void SignalNetClientGameChatMsg(const std::string &playerName, const std::string &msg);
|
|
||||||
void SignalNetClientLobbyChatMsg(const std::string &playerName, const std::string &msg);
|
|
||||||
void SignalNetClientMsgBox(const std::string &msg);
|
|
||||||
void SignalNetClientWaitDialog();
|
|
||||||
|
|
||||||
void SignalNetClientGameListNew(unsigned gameId);
|
void startVoteOnKick(unsigned playerId, unsigned voteStarterPlayerId, int timeoutSec, int numVotesNeededToKick);
|
||||||
void SignalNetClientGameListRemove(unsigned gameId);
|
void changeVoteOnKickButtonsState(bool showHide);
|
||||||
void SignalNetClientGameListUpdateMode(unsigned gameId, GameMode mode);
|
void refreshVotesMonitor(int currentVotes, int numVotesNeededToKick);
|
||||||
void SignalNetClientGameListUpdateAdmin(unsigned gameId, unsigned adminPlayerId);
|
void endVoteOnKick();
|
||||||
void SignalNetClientGameListPlayerJoined(unsigned gameId, unsigned playerId);
|
|
||||||
void SignalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId);
|
|
||||||
|
|
||||||
void SignalNetClientGameStart(boost::shared_ptr<Game> game);
|
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
||||||
|
void logNewGameHandMsg(int gameID, int handID) ;
|
||||||
|
void logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName);
|
||||||
|
void logPlayerWinsMsg(std::string playerName, int pot, bool main);
|
||||||
|
void logPlayerSitsOut(std::string playerName);
|
||||||
|
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1);
|
||||||
|
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows");
|
||||||
|
void logPlayerWinGame(std::string playerName, int gameID);
|
||||||
|
void flushLogAtGame(int gameID);
|
||||||
|
void flushLogAtHand();
|
||||||
|
|
||||||
void SignalNetServerSuccess(int actionID);
|
void SignalNetClientConnect(int actionID);
|
||||||
void SignalNetServerError(int errorID, int osErrorID);
|
void SignalNetClientServerListAdd(unsigned serverId);
|
||||||
|
void SignalNetClientServerListShow();
|
||||||
|
void SignalNetClientServerListClear();
|
||||||
|
void SignalNetClientLoginShow();
|
||||||
|
void SignalNetClientGameInfo(int actionID);
|
||||||
|
void SignalNetClientError(int errorID, int osErrorID);
|
||||||
|
void SignalNetClientNotification(int notificationId);
|
||||||
|
void SignalNetClientStatsUpdate(const ServerStats &stats);
|
||||||
|
void SignalNetClientShowTimeoutDialog(NetTimeoutReason reason, unsigned remainingSec);
|
||||||
|
void SignalNetClientRemovedFromGame(int notificationId);
|
||||||
|
void SignalNetClientSelfJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin);
|
||||||
|
void SignalNetClientPlayerJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin);
|
||||||
|
void SignalNetClientPlayerChanged(unsigned playerId, const std::string &newPlayerName);
|
||||||
|
void SignalNetClientPlayerLeft(unsigned playerId, const std::string &playerName, int removeReason);
|
||||||
|
void SignalNetClientNewGameAdmin(unsigned playerId, const std::string &playerName);
|
||||||
|
void SignalNetClientGameChatMsg(const std::string &playerName, const std::string &msg);
|
||||||
|
void SignalNetClientLobbyChatMsg(const std::string &playerName, const std::string &msg);
|
||||||
|
void SignalNetClientMsgBox(const std::string &msg);
|
||||||
|
void SignalNetClientWaitDialog();
|
||||||
|
|
||||||
void SignalIrcConnect(const std::string &server);
|
void SignalNetClientGameListNew(unsigned gameId);
|
||||||
void SignalIrcSelfJoined(const std::string &nickName, const std::string &channel);
|
void SignalNetClientGameListRemove(unsigned gameId);
|
||||||
void SignalIrcPlayerJoined(const std::string &nickName);
|
void SignalNetClientGameListUpdateMode(unsigned gameId, GameMode mode);
|
||||||
void SignalIrcPlayerChanged(const std::string &oldNick, const std::string &newNick);
|
void SignalNetClientGameListUpdateAdmin(unsigned gameId, unsigned adminPlayerId);
|
||||||
void SignalIrcPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason);
|
void SignalNetClientGameListPlayerJoined(unsigned gameId, unsigned playerId);
|
||||||
void SignalIrcPlayerLeft(const std::string &nickName);
|
void SignalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId);
|
||||||
void SignalIrcChatMsg(const std::string &nickName, const std::string &msg);
|
|
||||||
void SignalIrcError(int errorCode);
|
|
||||||
void SignalIrcServerError(int errorCode);
|
|
||||||
void SignalLobbyPlayerJoined(unsigned playerId, const std::string &nickName);
|
|
||||||
void SignalLobbyPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason);
|
|
||||||
void SignalLobbyPlayerLeft(unsigned playerId);
|
|
||||||
|
|
||||||
void SignalSelfGameInvitation(unsigned gameId, unsigned playerIdFrom);
|
void SignalNetClientGameStart(boost::shared_ptr<Game> game);
|
||||||
void SignalPlayerGameInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom);
|
|
||||||
void SignalRejectedGameInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
|
void SignalNetServerSuccess(int actionID);
|
||||||
|
void SignalNetServerError(int errorID, int osErrorID);
|
||||||
|
|
||||||
|
void SignalIrcConnect(const std::string &server);
|
||||||
|
void SignalIrcSelfJoined(const std::string &nickName, const std::string &channel);
|
||||||
|
void SignalIrcPlayerJoined(const std::string &nickName);
|
||||||
|
void SignalIrcPlayerChanged(const std::string &oldNick, const std::string &newNick);
|
||||||
|
void SignalIrcPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason);
|
||||||
|
void SignalIrcPlayerLeft(const std::string &nickName);
|
||||||
|
void SignalIrcChatMsg(const std::string &nickName, const std::string &msg);
|
||||||
|
void SignalIrcError(int errorCode);
|
||||||
|
void SignalIrcServerError(int errorCode);
|
||||||
|
void SignalLobbyPlayerJoined(unsigned playerId, const std::string &nickName);
|
||||||
|
void SignalLobbyPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason);
|
||||||
|
void SignalLobbyPlayerLeft(unsigned playerId);
|
||||||
|
|
||||||
|
void SignalSelfGameInvitation(unsigned gameId, unsigned playerIdFrom);
|
||||||
|
void SignalPlayerGameInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom);
|
||||||
|
void SignalRejectedGameInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Log *myLog;
|
Log *myLog;
|
||||||
gameTableImpl *myW;
|
gameTableImpl *myW;
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
startWindowImpl *myStartWindow;
|
startWindowImpl *myStartWindow;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ myMessageDialogImpl::myMessageDialogImpl(ConfigFile *c, QWidget *parent)
|
|||||||
: QDialog(parent), myConfig(c), currentMsgId(0)
|
: QDialog(parent), myConfig(c), currentMsgId(0)
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
setWindowModality(Qt::ApplicationModal);
|
setWindowModality(Qt::ApplicationModal);
|
||||||
setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
|
setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
|
||||||
#endif
|
#endif
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
int myMessageDialogImpl::exec(int messageId, QString msg, QString title, QPixmap pix, QDialogButtonBox::StandardButtons buttons, bool showCheckBox)
|
int myMessageDialogImpl::exec(int messageId, QString msg, QString title, QPixmap pix, QDialogButtonBox::StandardButtons buttons, bool showCheckBox)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -47,115 +47,106 @@ class serverListDialogImpl;
|
|||||||
class internetGameLoginDialogImpl;
|
class internetGameLoginDialogImpl;
|
||||||
|
|
||||||
class startWindowImpl: public QMainWindow, public Ui::startWindow {
|
class startWindowImpl: public QMainWindow, public Ui::startWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
startWindowImpl(ConfigFile *c =0);
|
startWindowImpl(ConfigFile *c =0);
|
||||||
|
|
||||||
void setSession(boost::shared_ptr<Session> session) { mySession = session; }
|
void setSession(boost::shared_ptr<Session> session) { mySession = session; }
|
||||||
boost::shared_ptr<Session> getSession() { assert(mySession.get()); return mySession; }
|
boost::shared_ptr<Session> getSession() { assert(mySession.get()); return mySession; }
|
||||||
boost::shared_ptr< GuiInterface > getMyServerGuiInterface() const { return myServerGuiInterface; }
|
boost::shared_ptr< GuiInterface > getMyServerGuiInterface() const { return myServerGuiInterface; }
|
||||||
connectToServerDialogImpl* getMyConnectToServerDialog() const { return myConnectToServerDialog; }
|
connectToServerDialogImpl* getMyConnectToServerDialog() const { return myConnectToServerDialog; }
|
||||||
|
|
||||||
|
// void keyPressEvent( QKeyEvent *);
|
||||||
|
|
||||||
// void keyPressEvent( QKeyEvent *);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void signalShowClientDialog();
|
void signalShowClientDialog();
|
||||||
|
|
||||||
void signalNetClientConnect(int actionID);
|
|
||||||
void signalNetClientServerListShow();
|
|
||||||
void signalNetClientServerListClear();
|
|
||||||
void signalNetClientServerListAdd(unsigned serverId);
|
|
||||||
void signalNetClientLoginShow();
|
|
||||||
void signalNetClientGameInfo(int actionID);
|
|
||||||
void signalNetClientError(int errorID, int osErrorID);
|
|
||||||
void signalNetClientNotification(int notificationId);
|
|
||||||
void signalNetClientStatsUpdate(ServerStats stats);
|
|
||||||
void signalNetClientShowTimeoutDialog(int, unsigned);
|
|
||||||
void signalNetClientRemovedFromGame(int notificationId);
|
|
||||||
void signalNetServerError(int errorID, int osErrorID);
|
|
||||||
void signalNetClientSelfJoined(unsigned playerId, QString playerName, bool isGameAdmin);
|
|
||||||
void signalNetClientPlayerJoined(unsigned playerId, QString playerName, bool isGameAdmin);
|
|
||||||
void signalNetClientPlayerChanged(unsigned playerId, QString newPlayerName);
|
|
||||||
void signalNetClientPlayerLeft(unsigned playerId, QString playerName);
|
|
||||||
void signalNetClientNewGameAdmin(unsigned playerId, QString playerName);
|
|
||||||
void signalNetClientGameListNew(unsigned gameId);
|
|
||||||
void signalNetClientGameListRemove(unsigned gameId);
|
|
||||||
void signalNetClientGameListUpdateMode(unsigned gameId, int mode);
|
|
||||||
void signalNetClientGameListUpdateAdmin(unsigned gameId, unsigned adminPlayerId);
|
|
||||||
void signalNetClientGameListPlayerJoined(unsigned gameId, unsigned playerId);
|
|
||||||
void signalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId);
|
|
||||||
void signalNetClientGameStart(boost::shared_ptr<Game> game);
|
|
||||||
void signalNetClientGameChatMsg(QString nickName, QString msg);
|
|
||||||
void signalNetClientLobbyChatMsg(QString nickName, QString msg);
|
|
||||||
void signalNetClientMsgBox(QString msg);
|
|
||||||
|
|
||||||
// void signalIrcConnect(QString server);
|
void signalNetClientConnect(int actionID);
|
||||||
// void signalIrcSelfJoined(QString nickName, QString channel);
|
void signalNetClientServerListShow();
|
||||||
// void signalIrcPlayerJoined(QString nickName);
|
void signalNetClientServerListClear();
|
||||||
// void signalIrcPlayerChanged(QString oldNick, QString newNick);
|
void signalNetClientServerListAdd(unsigned serverId);
|
||||||
// void signalIrcPlayerKicked(QString nickName, QString byWhom, QString reason);
|
void signalNetClientLoginShow();
|
||||||
// void signalIrcPlayerLeft(QString nickName);
|
void signalNetClientGameInfo(int actionID);
|
||||||
// void signalIrcChatMessage(QString nickName, QString msg);
|
void signalNetClientError(int errorID, int osErrorID);
|
||||||
// void signalIrcError(int errorCode);
|
void signalNetClientNotification(int notificationId);
|
||||||
// void signalIrcServerError(int errorCode);
|
void signalNetClientStatsUpdate(ServerStats stats);
|
||||||
void signalLobbyPlayerJoined(unsigned playerId, QString nickName);
|
void signalNetClientShowTimeoutDialog(int, unsigned);
|
||||||
void signalLobbyPlayerKicked(QString nickName, QString byWhom, QString reason);
|
void signalNetClientRemovedFromGame(int notificationId);
|
||||||
void signalLobbyPlayerLeft(unsigned playerId);
|
void signalNetServerError(int errorID, int osErrorID);
|
||||||
|
void signalNetClientSelfJoined(unsigned playerId, QString playerName, bool isGameAdmin);
|
||||||
|
void signalNetClientPlayerJoined(unsigned playerId, QString playerName, bool isGameAdmin);
|
||||||
|
void signalNetClientPlayerChanged(unsigned playerId, QString newPlayerName);
|
||||||
|
void signalNetClientPlayerLeft(unsigned playerId, QString playerName);
|
||||||
|
void signalNetClientNewGameAdmin(unsigned playerId, QString playerName);
|
||||||
|
void signalNetClientGameListNew(unsigned gameId);
|
||||||
|
void signalNetClientGameListRemove(unsigned gameId);
|
||||||
|
void signalNetClientGameListUpdateMode(unsigned gameId, int mode);
|
||||||
|
void signalNetClientGameListUpdateAdmin(unsigned gameId, unsigned adminPlayerId);
|
||||||
|
void signalNetClientGameListPlayerJoined(unsigned gameId, unsigned playerId);
|
||||||
|
void signalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId);
|
||||||
|
void signalNetClientGameStart(boost::shared_ptr<Game> game);
|
||||||
|
void signalNetClientGameChatMsg(QString nickName, QString msg);
|
||||||
|
void signalNetClientLobbyChatMsg(QString nickName, QString msg);
|
||||||
|
void signalNetClientMsgBox(QString msg);
|
||||||
|
|
||||||
void signalSelfGameInvitation(unsigned gameId, unsigned playerIdFrom);
|
void signalLobbyPlayerJoined(unsigned playerId, QString nickName);
|
||||||
void signalPlayerGameInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom);
|
void signalLobbyPlayerKicked(QString nickName, QString byWhom, QString reason);
|
||||||
void signalRejectedGameInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
|
void signalLobbyPlayerLeft(unsigned playerId);
|
||||||
|
|
||||||
|
void signalSelfGameInvitation(unsigned gameId, unsigned playerIdFrom);
|
||||||
|
void signalPlayerGameInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom);
|
||||||
|
void signalRejectedGameInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void callAboutPokerthDialog();
|
void callAboutPokerthDialog();
|
||||||
void callSettingsDialog();
|
void callSettingsDialog();
|
||||||
void callNewGameDialog();
|
void callNewGameDialog();
|
||||||
void callGameLobbyDialog();
|
void callGameLobbyDialog();
|
||||||
void callCreateNetworkGameDialog();
|
void callCreateNetworkGameDialog();
|
||||||
void callJoinNetworkGameDialog();
|
void callJoinNetworkGameDialog();
|
||||||
void showLobbyDialog();
|
void showLobbyDialog();
|
||||||
void callInternetGameLoginDialog();
|
void callInternetGameLoginDialog();
|
||||||
void joinGameLobby();
|
void joinGameLobby();
|
||||||
void showClientDialog();
|
void showClientDialog();
|
||||||
void showNetworkStartDialog();
|
void showNetworkStartDialog();
|
||||||
|
|
||||||
void startNewLocalGame(newGameDialogImpl* =0);
|
void startNewLocalGame(newGameDialogImpl* =0);
|
||||||
|
|
||||||
void showTimeoutDialog(int msgID, unsigned duration);
|
void showTimeoutDialog(int msgID, unsigned duration);
|
||||||
void hideTimeoutDialog();
|
void hideTimeoutDialog();
|
||||||
|
|
||||||
void networkError(int, int);
|
void networkError(int, int);
|
||||||
void networkNotification(int);
|
void networkNotification(int);
|
||||||
void networkMessage(QString);
|
void networkMessage(QString);
|
||||||
|
|
||||||
|
void networkStart(boost::shared_ptr<Game> game);
|
||||||
|
QStringList getPlayerNicksList();
|
||||||
|
|
||||||
void networkStart(boost::shared_ptr<Game> game);
|
|
||||||
QStringList getPlayerNicksList();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
|
|
||||||
boost::shared_ptr<GuiInterface> myGuiInterface;
|
boost::shared_ptr<GuiInterface> myGuiInterface;
|
||||||
boost::shared_ptr<Session> mySession;
|
boost::shared_ptr<Session> mySession;
|
||||||
boost::shared_ptr<GuiInterface> myServerGuiInterface;
|
boost::shared_ptr<GuiInterface> myServerGuiInterface;
|
||||||
|
|
||||||
// Dialogs
|
// Dialogs
|
||||||
aboutPokerthImpl *myAboutPokerthDialog;
|
aboutPokerthImpl *myAboutPokerthDialog;
|
||||||
newGameDialogImpl *myNewGameDialog;
|
newGameDialogImpl *myNewGameDialog;
|
||||||
settingsDialogImpl *mySettingsDialog;
|
settingsDialogImpl *mySettingsDialog;
|
||||||
selectAvatarDialogImpl *mySelectAvatarDialog;
|
selectAvatarDialogImpl *mySelectAvatarDialog;
|
||||||
changeHumanPlayerNameDialogImpl *myChangeHumanPlayerNameDialog;
|
changeHumanPlayerNameDialogImpl *myChangeHumanPlayerNameDialog;
|
||||||
joinNetworkGameDialogImpl *myJoinNetworkGameDialog;
|
joinNetworkGameDialogImpl *myJoinNetworkGameDialog;
|
||||||
connectToServerDialogImpl *myConnectToServerDialog;
|
connectToServerDialogImpl *myConnectToServerDialog;
|
||||||
startNetworkGameDialogImpl *myStartNetworkGameDialog;
|
startNetworkGameDialogImpl *myStartNetworkGameDialog;
|
||||||
createNetworkGameDialogImpl *myCreateNetworkGameDialog;
|
createNetworkGameDialogImpl *myCreateNetworkGameDialog;
|
||||||
gameLobbyDialogImpl *myGameLobbyDialog;
|
gameLobbyDialogImpl *myGameLobbyDialog;
|
||||||
timeoutMsgBoxImpl *myTimeoutDialog;
|
timeoutMsgBoxImpl *myTimeoutDialog;
|
||||||
startWindowImpl *myStartWindow;
|
startWindowImpl *myStartWindow;
|
||||||
serverListDialogImpl *myServerListDialog;
|
serverListDialogImpl *myServerListDialog;
|
||||||
internetGameLoginDialogImpl *myInternetGameLoginDialog;
|
internetGameLoginDialogImpl *myInternetGameLoginDialog;
|
||||||
|
|
||||||
friend class GuiWrapper;
|
friend class GuiWrapper;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+292
-292
@@ -44,495 +44,495 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
Session::Session(GuiInterface *g, ConfigFile *c)
|
Session::Session(GuiInterface *g, ConfigFile *c)
|
||||||
: currentGameNum(0), myGui(g), myConfig(c), myGameType(GAME_TYPE_NONE)
|
: currentGameNum(0), myGui(g), myConfig(c), myGameType(GAME_TYPE_NONE)
|
||||||
{
|
{
|
||||||
myQtToolsInterface = CreateQtToolsWrapper();
|
myQtToolsInterface = CreateQtToolsWrapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Session::~Session()
|
Session::~Session()
|
||||||
{
|
{
|
||||||
terminateNetworkClient();
|
terminateNetworkClient();
|
||||||
terminateNetworkServer();
|
terminateNetworkServer();
|
||||||
delete myConfig;
|
delete myConfig;
|
||||||
myConfig = 0;
|
myConfig = 0;
|
||||||
delete myQtToolsInterface;
|
delete myQtToolsInterface;
|
||||||
myQtToolsInterface = 0;
|
myQtToolsInterface = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::init()
|
bool Session::init()
|
||||||
{
|
{
|
||||||
myAvatarManager.reset(new AvatarManager(
|
myAvatarManager.reset(new AvatarManager(
|
||||||
myConfig->readConfigInt("ServerUsePutAvatars") == 1,
|
myConfig->readConfigInt("ServerUsePutAvatars") == 1,
|
||||||
myConfig->readConfigString("ServerPutAvatarsAddress"),
|
myConfig->readConfigString("ServerPutAvatarsAddress"),
|
||||||
myConfig->readConfigString("ServerPutAvatarsUser"),
|
myConfig->readConfigString("ServerPutAvatarsUser"),
|
||||||
myConfig->readConfigString("ServerPutAvatarsPassword")
|
myConfig->readConfigString("ServerPutAvatarsPassword")
|
||||||
));
|
));
|
||||||
bool retVal = myAvatarManager->Init(
|
bool retVal = myAvatarManager->Init(
|
||||||
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("AppDataDir")),
|
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("AppDataDir")),
|
||||||
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("CacheDir")));
|
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("CacheDir")));
|
||||||
addOwnAvatar(myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("MyAvatar")));
|
addOwnAvatar(myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("MyAvatar")));
|
||||||
myAvatarManager->RemoveOldAvatarCacheEntries();
|
myAvatarManager->RemoveOldAvatarCacheEntries();
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::init(boost::shared_ptr<AvatarManager> manager)
|
void Session::init(boost::shared_ptr<AvatarManager> manager)
|
||||||
{
|
{
|
||||||
myAvatarManager = manager;
|
myAvatarManager = manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::addOwnAvatar(const std::string &avatarFile)
|
void Session::addOwnAvatar(const std::string &avatarFile)
|
||||||
{
|
{
|
||||||
myAvatarManager->AddSingleAvatar(avatarFile);
|
myAvatarManager->AddSingleAvatar(avatarFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::startLocalGame(const GameData &gameData, const StartData &startData) {
|
void Session::startLocalGame(const GameData &gameData, const StartData &startData) {
|
||||||
|
|
||||||
myGameType = GAME_TYPE_LOCAL;
|
myGameType = GAME_TYPE_LOCAL;
|
||||||
|
|
||||||
currentGame.reset();
|
currentGame.reset();
|
||||||
currentGameNum++;
|
currentGameNum++;
|
||||||
|
|
||||||
myGui->initGui(gameData.guiSpeed);
|
myGui->initGui(gameData.guiSpeed);
|
||||||
|
|
||||||
PlayerDataList playerDataList;
|
PlayerDataList playerDataList;
|
||||||
for(int i = 0; i < startData.numberOfPlayers; i++) {
|
for(int i = 0; i < startData.numberOfPlayers; i++) {
|
||||||
|
|
||||||
//Namen und Avatarpfad abfragen
|
//Namen und Avatarpfad abfragen
|
||||||
ostringstream myName;
|
ostringstream myName;
|
||||||
if (i==0) { myName << "MyName"; }
|
if (i==0) { myName << "MyName"; }
|
||||||
else { myName << "Opponent" << i << "Name"; }
|
else { myName << "Opponent" << i << "Name"; }
|
||||||
ostringstream myAvatar;
|
ostringstream myAvatar;
|
||||||
if (i==0) { myAvatar << "MyAvatar"; }
|
if (i==0) { myAvatar << "MyAvatar"; }
|
||||||
else { myAvatar << "Opponent" << i << "Avatar"; }
|
else { myAvatar << "Opponent" << i << "Avatar"; }
|
||||||
|
|
||||||
//PlayerData erzeugen
|
//PlayerData erzeugen
|
||||||
// UniqueId = PlayerNumber for local games.
|
// UniqueId = PlayerNumber for local games.
|
||||||
boost::shared_ptr<PlayerData> playerData(new PlayerData(i, i,
|
boost::shared_ptr<PlayerData> playerData(new PlayerData(i, i,
|
||||||
i == 0 ? PLAYER_TYPE_HUMAN : PLAYER_TYPE_COMPUTER,
|
i == 0 ? PLAYER_TYPE_HUMAN : PLAYER_TYPE_COMPUTER,
|
||||||
PLAYER_RIGHTS_NORMAL,
|
PLAYER_RIGHTS_NORMAL,
|
||||||
i == 0));
|
i == 0));
|
||||||
playerData->SetName(myConfig->readConfigString(myName.str()));
|
playerData->SetName(myConfig->readConfigString(myName.str()));
|
||||||
playerData->SetAvatarFile(myConfig->readConfigString(myAvatar.str()));
|
playerData->SetAvatarFile(myConfig->readConfigString(myAvatar.str()));
|
||||||
|
|
||||||
playerDataList.push_back(playerData);
|
playerDataList.push_back(playerData);
|
||||||
}
|
}
|
||||||
// EngineFactory erstellen
|
// EngineFactory erstellen
|
||||||
boost::shared_ptr<EngineFactory> factory(new LocalEngineFactory(myConfig)); // LocalEngine erstellen
|
boost::shared_ptr<EngineFactory> factory(new LocalEngineFactory(myConfig)); // LocalEngine erstellen
|
||||||
|
|
||||||
currentGame.reset(new Game(myGui, factory, playerDataList, gameData, startData, currentGameNum));
|
currentGame.reset(new Game(myGui, factory, playerDataList, gameData, startData, currentGameNum));
|
||||||
|
|
||||||
//// SPIEL-SCHLEIFE
|
//// SPIEL-SCHLEIFE
|
||||||
currentGame->initHand();
|
currentGame->initHand();
|
||||||
currentGame->startHand();
|
currentGame->startHand();
|
||||||
// SPIEL-SCHLEIFE
|
// SPIEL-SCHLEIFE
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::startClientGame(boost::shared_ptr<Game> game)
|
void Session::startClientGame(boost::shared_ptr<Game> game)
|
||||||
{
|
{
|
||||||
currentGameNum++;
|
currentGameNum++;
|
||||||
|
|
||||||
currentGame = game;
|
currentGame = game;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game *Session::getCurrentGame()
|
Game *Session::getCurrentGame()
|
||||||
{
|
{
|
||||||
return currentGame.get();
|
return currentGame.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiInterface *Session::getGui()
|
GuiInterface *Session::getGui()
|
||||||
{
|
{
|
||||||
return myGui;
|
return myGui;
|
||||||
}
|
}
|
||||||
|
|
||||||
Session::GameType Session::getGameType()
|
Session::GameType Session::getGameType()
|
||||||
{
|
{
|
||||||
return myGameType;
|
return myGameType;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<AvatarManager> Session::getAvatarManager()
|
boost::shared_ptr<AvatarManager> Session::getAvatarManager()
|
||||||
{
|
{
|
||||||
return myAvatarManager;
|
return myAvatarManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::startInternetClient()
|
void Session::startInternetClient()
|
||||||
{
|
{
|
||||||
if (myNetClient || !myGui)
|
if (myNetClient || !myGui)
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
myGameType = GAME_TYPE_INTERNET;
|
myGameType = GAME_TYPE_INTERNET;
|
||||||
|
|
||||||
myNetClient.reset(new ClientThread(*myGui, *myAvatarManager));
|
myNetClient.reset(new ClientThread(*myGui, *myAvatarManager));
|
||||||
bool useAvatarServer = myConfig->readConfigInt("UseAvatarServer") != 0;
|
bool useAvatarServer = myConfig->readConfigInt("UseAvatarServer") != 0;
|
||||||
|
|
||||||
myNetClient->Init(
|
myNetClient->Init(
|
||||||
myConfig->readConfigString("InternetServerAddress"),
|
myConfig->readConfigString("InternetServerAddress"),
|
||||||
#ifdef POKERTH_IS_07BETA
|
#ifdef POKERTH_IS_07BETA
|
||||||
"pokerth.net/serverlist07.xml.z", 1,
|
"pokerth.net/serverlist07.xml.z", 1,
|
||||||
#else
|
#else
|
||||||
myConfig->readConfigString("InternetServerListAddress"),
|
myConfig->readConfigString("InternetServerListAddress"),
|
||||||
myConfig->readConfigInt("InternetServerConfigMode") == 0,
|
myConfig->readConfigInt("InternetServerConfigMode") == 0,
|
||||||
#endif
|
#endif
|
||||||
myConfig->readConfigInt("InternetServerPort"),
|
myConfig->readConfigInt("InternetServerPort"),
|
||||||
myConfig->readConfigInt("InternetServerUseIpv6") == 1,
|
myConfig->readConfigInt("InternetServerUseIpv6") == 1,
|
||||||
myConfig->readConfigInt("InternetServerUseSctp") == 1,
|
myConfig->readConfigInt("InternetServerUseSctp") == 1,
|
||||||
useAvatarServer ? myConfig->readConfigString("AvatarServerAddress") : "",
|
useAvatarServer ? myConfig->readConfigString("AvatarServerAddress") : "",
|
||||||
myConfig->readConfigString("MyName"),
|
myConfig->readConfigString("MyName"),
|
||||||
myConfig->readConfigString("MyAvatar"),
|
myConfig->readConfigString("MyAvatar"),
|
||||||
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("CacheDir")));
|
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("CacheDir")));
|
||||||
myNetClient->Run();
|
myNetClient->Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::startNetworkClient(const string &serverAddress, unsigned serverPort, bool ipv6, bool sctp)
|
void Session::startNetworkClient(const string &serverAddress, unsigned serverPort, bool ipv6, bool sctp)
|
||||||
{
|
{
|
||||||
if (myNetClient || !myGui)
|
if (myNetClient || !myGui)
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
myGameType = GAME_TYPE_NETWORK;
|
myGameType = GAME_TYPE_NETWORK;
|
||||||
|
|
||||||
myNetClient.reset(new ClientThread(*myGui, *myAvatarManager));
|
myNetClient.reset(new ClientThread(*myGui, *myAvatarManager));
|
||||||
myNetClient->Init(
|
myNetClient->Init(
|
||||||
serverAddress,
|
serverAddress,
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
serverPort,
|
serverPort,
|
||||||
ipv6,
|
ipv6,
|
||||||
sctp,
|
sctp,
|
||||||
"", // no avatar server
|
"", // no avatar server
|
||||||
myConfig->readConfigString("MyName"),
|
myConfig->readConfigString("MyName"),
|
||||||
myConfig->readConfigString("MyAvatar"),
|
myConfig->readConfigString("MyAvatar"),
|
||||||
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("CacheDir")));
|
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("CacheDir")));
|
||||||
myNetClient->Run();
|
myNetClient->Run();
|
||||||
myNetClient->SendJoinFirstGame("");
|
myNetClient->SendJoinFirstGame("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::startNetworkClientForLocalServer(const GameData &gameData)
|
void Session::startNetworkClientForLocalServer(const GameData &gameData)
|
||||||
{
|
{
|
||||||
if (myNetClient || !myGui)
|
if (myNetClient || !myGui)
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
myGameType = GAME_TYPE_NETWORK;
|
myGameType = GAME_TYPE_NETWORK;
|
||||||
|
|
||||||
myNetClient.reset(new ClientThread(*myGui, *myAvatarManager));
|
myNetClient.reset(new ClientThread(*myGui, *myAvatarManager));
|
||||||
bool useIpv6 = myConfig->readConfigInt("ServerUseIpv6") == 1;
|
bool useIpv6 = myConfig->readConfigInt("ServerUseIpv6") == 1;
|
||||||
const char *loopbackAddr = useIpv6 ? "::1" : "127.0.0.1";
|
const char *loopbackAddr = useIpv6 ? "::1" : "127.0.0.1";
|
||||||
myNetClient->Init(
|
myNetClient->Init(
|
||||||
loopbackAddr,
|
loopbackAddr,
|
||||||
"",
|
"",
|
||||||
false,
|
false,
|
||||||
myConfig->readConfigInt("ServerPort"),
|
myConfig->readConfigInt("ServerPort"),
|
||||||
useIpv6,
|
useIpv6,
|
||||||
myConfig->readConfigInt("ServerUseSctp") == 1,
|
myConfig->readConfigInt("ServerUseSctp") == 1,
|
||||||
"", // no avatar server
|
"", // no avatar server
|
||||||
myConfig->readConfigString("MyName"),
|
myConfig->readConfigString("MyName"),
|
||||||
myConfig->readConfigString("MyAvatar"),
|
myConfig->readConfigString("MyAvatar"),
|
||||||
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("CacheDir")));
|
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("CacheDir")));
|
||||||
myNetClient->Run();
|
myNetClient->Run();
|
||||||
myNetClient->SendCreateGame(gameData, NET_DEFAULT_GAME, "");
|
myNetClient->SendCreateGame(gameData, NET_DEFAULT_GAME, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::terminateNetworkClient()
|
void Session::terminateNetworkClient()
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // already terminated
|
return; // already terminated
|
||||||
myNetClient->SignalTermination();
|
myNetClient->SignalTermination();
|
||||||
// Give the threads some time to terminate.
|
// Give the threads some time to terminate.
|
||||||
if (myNetClient->Join(NET_CLIENT_TERMINATE_TIMEOUT_MSEC))
|
if (myNetClient->Join(NET_CLIENT_TERMINATE_TIMEOUT_MSEC))
|
||||||
myNetClient.reset();
|
myNetClient.reset();
|
||||||
|
|
||||||
// If termination fails, leave a memory leak to prevent a crash.
|
// If termination fails, leave a memory leak to prevent a crash.
|
||||||
myGameType = GAME_TYPE_NONE;
|
myGameType = GAME_TYPE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::clientCreateGame(const GameData &gameData, const string &name, const string &password)
|
void Session::clientCreateGame(const GameData &gameData, const string &name, const string &password)
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SendCreateGame(gameData, name, password);
|
myNetClient->SendCreateGame(gameData, name, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::clientJoinGame(unsigned gameId, const std::string &password)
|
void Session::clientJoinGame(unsigned gameId, const std::string &password)
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SendJoinGame(gameId, password);
|
myNetClient->SendJoinGame(gameId, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::startNetworkServer(bool dedicated)
|
void Session::startNetworkServer(bool dedicated)
|
||||||
{
|
{
|
||||||
if (myNetServer)
|
if (myNetServer)
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
myNetServer.reset(new ServerManager(*myGui, myConfig, *myAvatarManager));
|
myNetServer.reset(new ServerManager(*myGui, myConfig, *myAvatarManager));
|
||||||
|
|
||||||
boost::shared_ptr<IrcThread> tmpIrcAdminThread;
|
boost::shared_ptr<IrcThread> tmpIrcAdminThread;
|
||||||
boost::shared_ptr<IrcThread> tmpIrcLobbyThread;
|
boost::shared_ptr<IrcThread> tmpIrcLobbyThread;
|
||||||
if (myConfig->readConfigInt("UseAdminIRC"))
|
if (myConfig->readConfigInt("UseAdminIRC"))
|
||||||
{
|
{
|
||||||
tmpIrcAdminThread = boost::shared_ptr<IrcThread>(new IrcThread(&myNetServer->GetAdminBot()));
|
tmpIrcAdminThread = boost::shared_ptr<IrcThread>(new IrcThread(&myNetServer->GetAdminBot()));
|
||||||
|
|
||||||
tmpIrcAdminThread->Init(
|
tmpIrcAdminThread->Init(
|
||||||
myConfig->readConfigString("AdminIRCServerAddress"),
|
myConfig->readConfigString("AdminIRCServerAddress"),
|
||||||
myConfig->readConfigInt("AdminIRCServerPort"),
|
myConfig->readConfigInt("AdminIRCServerPort"),
|
||||||
myConfig->readConfigInt("AdminIRCServerUseIpv6") == 1,
|
myConfig->readConfigInt("AdminIRCServerUseIpv6") == 1,
|
||||||
myConfig->readConfigString("AdminIRCServerNick"),
|
myConfig->readConfigString("AdminIRCServerNick"),
|
||||||
myConfig->readConfigString("AdminIRCChannel"),
|
myConfig->readConfigString("AdminIRCChannel"),
|
||||||
myConfig->readConfigString("AdminIRCChannelPassword"));
|
myConfig->readConfigString("AdminIRCChannelPassword"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myConfig->readConfigInt("UseLobbyIRC"))
|
|
||||||
{
|
|
||||||
tmpIrcLobbyThread = boost::shared_ptr<IrcThread>(new IrcThread(&myNetServer->GetLobbyBot()));
|
|
||||||
|
|
||||||
tmpIrcLobbyThread->Init(
|
if (myConfig->readConfigInt("UseLobbyIRC"))
|
||||||
myConfig->readConfigString("LobbyIRCServerAddress"),
|
{
|
||||||
myConfig->readConfigInt("LobbyIRCServerPort"),
|
tmpIrcLobbyThread = boost::shared_ptr<IrcThread>(new IrcThread(&myNetServer->GetLobbyBot()));
|
||||||
myConfig->readConfigInt("LobbyIRCServerUseIpv6") == 1,
|
|
||||||
myConfig->readConfigString("LobbyIRCServerNick"),
|
|
||||||
myConfig->readConfigString("LobbyIRCChannel"),
|
|
||||||
myConfig->readConfigString("LobbyIRCChannelPassword"));
|
|
||||||
}
|
|
||||||
|
|
||||||
ServerMode mode;
|
tmpIrcLobbyThread->Init(
|
||||||
if (dedicated)
|
myConfig->readConfigString("LobbyIRCServerAddress"),
|
||||||
{
|
myConfig->readConfigInt("LobbyIRCServerPort"),
|
||||||
#ifdef POKERTH_OFFICIAL_SERVER
|
myConfig->readConfigInt("LobbyIRCServerUseIpv6") == 1,
|
||||||
mode = SERVER_MODE_INTERNET_AUTH;
|
myConfig->readConfigString("LobbyIRCServerNick"),
|
||||||
#else
|
myConfig->readConfigString("LobbyIRCChannel"),
|
||||||
mode = SERVER_MODE_INTERNET_NOAUTH;
|
myConfig->readConfigString("LobbyIRCChannelPassword"));
|
||||||
#endif
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
mode = SERVER_MODE_LAN;
|
|
||||||
|
|
||||||
myNetServer->Init(
|
ServerMode mode;
|
||||||
myConfig->readConfigInt("ServerPort"),
|
if (dedicated)
|
||||||
myConfig->readConfigInt("ServerUseIpv6") == 1,
|
{
|
||||||
myConfig->readConfigInt("ServerUseSctp") == 1 ? TRANSPORT_PROTOCOL_TCP_SCTP : TRANSPORT_PROTOCOL_TCP,
|
#ifdef POKERTH_OFFICIAL_SERVER
|
||||||
mode,
|
mode = SERVER_MODE_INTERNET_AUTH;
|
||||||
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("LogDir")),
|
#else
|
||||||
tmpIrcAdminThread,
|
mode = SERVER_MODE_INTERNET_NOAUTH;
|
||||||
tmpIrcLobbyThread
|
#endif
|
||||||
);
|
}
|
||||||
|
else
|
||||||
|
mode = SERVER_MODE_LAN;
|
||||||
|
|
||||||
myNetServer->RunAll();
|
myNetServer->Init(
|
||||||
|
myConfig->readConfigInt("ServerPort"),
|
||||||
|
myConfig->readConfigInt("ServerUseIpv6") == 1,
|
||||||
|
myConfig->readConfigInt("ServerUseSctp") == 1 ? TRANSPORT_PROTOCOL_TCP_SCTP : TRANSPORT_PROTOCOL_TCP,
|
||||||
|
mode,
|
||||||
|
myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("LogDir")),
|
||||||
|
tmpIrcAdminThread,
|
||||||
|
tmpIrcLobbyThread
|
||||||
|
);
|
||||||
|
|
||||||
|
myNetServer->RunAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::terminateNetworkServer()
|
void Session::terminateNetworkServer()
|
||||||
{
|
{
|
||||||
if (!myNetServer)
|
if (!myNetServer)
|
||||||
return; // already terminated
|
return; // already terminated
|
||||||
myNetServer->SignalTerminationAll();
|
myNetServer->SignalTerminationAll();
|
||||||
// Give the thread some time to terminate.
|
// Give the thread some time to terminate.
|
||||||
if (myNetServer->JoinAll(true))
|
if (myNetServer->JoinAll(true))
|
||||||
myNetServer.reset();
|
myNetServer.reset();
|
||||||
// If termination fails, leave a memory leak to prevent a crash.
|
// If termination fails, leave a memory leak to prevent a crash.
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::pollNetworkServerTerminated()
|
bool Session::pollNetworkServerTerminated()
|
||||||
{
|
{
|
||||||
bool retVal = false;
|
bool retVal = false;
|
||||||
if (!myNetServer)
|
if (!myNetServer)
|
||||||
retVal = true; // already terminated
|
retVal = true; // already terminated
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myNetServer->Process();
|
myNetServer->Process();
|
||||||
if (myNetServer->JoinAll(false))
|
if (myNetServer->JoinAll(false))
|
||||||
retVal = true;
|
retVal = true;
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::sendLeaveCurrentGame()
|
void Session::sendLeaveCurrentGame()
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SendLeaveCurrentGame();
|
myNetClient->SendLeaveCurrentGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::sendStartEvent(bool fillUpWithCpuPlayers)
|
void Session::sendStartEvent(bool fillUpWithCpuPlayers)
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SendStartEvent(fillUpWithCpuPlayers);
|
myNetClient->SendStartEvent(fillUpWithCpuPlayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::sendClientPlayerAction()
|
void Session::sendClientPlayerAction()
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SendPlayerAction();
|
myNetClient->SendPlayerAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::sendGameChatMessage(const std::string &message)
|
void Session::sendGameChatMessage(const std::string &message)
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SendGameChatMessage(message);
|
myNetClient->SendGameChatMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::sendLobbyChatMessage(const std::string &message)
|
void Session::sendLobbyChatMessage(const std::string &message)
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return;
|
return;
|
||||||
myNetClient->SendLobbyChatMessage(message);
|
myNetClient->SendLobbyChatMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::kickPlayer(unsigned playerId)
|
void Session::kickPlayer(unsigned playerId)
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SendKickPlayer(playerId);
|
myNetClient->SendKickPlayer(playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::resetNetworkTimeout()
|
void Session::resetNetworkTimeout()
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SendResetTimeout();
|
myNetClient->SendResetTimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::kickPlayer(const string &playerName)
|
void Session::kickPlayer(const string &playerName)
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
unsigned playerId;
|
unsigned playerId;
|
||||||
if (myNetClient->GetPlayerIdFromName(playerName, playerId))
|
if (myNetClient->GetPlayerIdFromName(playerName, playerId))
|
||||||
kickPlayer(playerId);
|
kickPlayer(playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::startVoteKickPlayer(unsigned playerId)
|
void Session::startVoteKickPlayer(unsigned playerId)
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SendAskKickPlayer(playerId);
|
myNetClient->SendAskKickPlayer(playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::selectServer(unsigned serverId)
|
void Session::selectServer(unsigned serverId)
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SelectServer(serverId);
|
myNetClient->SelectServer(serverId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Session::setLogin(const std::string &userName, const std::string &password, bool isGuest)
|
Session::setLogin(const std::string &userName, const std::string &password, bool isGuest)
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SetLogin(userName, password, isGuest);
|
myNetClient->SetLogin(userName, password, isGuest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Session::invitePlayerToCurrentGame(unsigned playerId)
|
Session::invitePlayerToCurrentGame(unsigned playerId)
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SendInvitePlayerToCurrentGame(playerId);
|
myNetClient->SendInvitePlayerToCurrentGame(playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Session::acceptGameInvitation(unsigned gameId)
|
Session::acceptGameInvitation(unsigned gameId)
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SendJoinGame(gameId, "");
|
myNetClient->SendJoinGame(gameId, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Session::rejectGameInvitation(unsigned gameId, DenyGameInvitationReason reason)
|
Session::rejectGameInvitation(unsigned gameId, DenyGameInvitationReason reason)
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SendRejectGameInvitation(gameId, reason);
|
myNetClient->SendRejectGameInvitation(gameId, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::voteKick(bool doKick)
|
void Session::voteKick(bool doKick)
|
||||||
{
|
{
|
||||||
if (!myNetClient)
|
if (!myNetClient)
|
||||||
return; // only act if client is running.
|
return; // only act if client is running.
|
||||||
myNetClient->SendVoteKick(doKick);
|
myNetClient->SendVoteKick(doKick);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::isNetworkClientRunning() const
|
bool Session::isNetworkClientRunning() const
|
||||||
{
|
{
|
||||||
// This, and every place which calls this, is a HACK.
|
// This, and every place which calls this, is a HACK.
|
||||||
return myNetClient.get() != NULL;
|
return myNetClient.get() != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::isNetworkServerRunning() const
|
bool Session::isNetworkServerRunning() const
|
||||||
{
|
{
|
||||||
// This, and every place which calls this, is a HACK.
|
// This, and every place which calls this, is a HACK.
|
||||||
return myNetServer.get() != NULL;
|
return myNetServer.get() != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerInfo Session::getClientServerInfo(unsigned serverId) const
|
ServerInfo Session::getClientServerInfo(unsigned serverId) const
|
||||||
{
|
{
|
||||||
ServerInfo info;
|
ServerInfo info;
|
||||||
if (myNetClient)
|
if (myNetClient)
|
||||||
info = myNetClient->GetServerInfo(serverId);
|
info = myNetClient->GetServerInfo(serverId);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameInfo Session::getClientGameInfo(unsigned playerId) const
|
GameInfo Session::getClientGameInfo(unsigned playerId) const
|
||||||
{
|
{
|
||||||
GameInfo info;
|
GameInfo info;
|
||||||
if (myNetClient)
|
if (myNetClient)
|
||||||
info = myNetClient->GetGameInfo(playerId);
|
info = myNetClient->GetGameInfo(playerId);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerInfo Session::getClientPlayerInfo(unsigned playerId) const
|
PlayerInfo Session::getClientPlayerInfo(unsigned playerId) const
|
||||||
{
|
{
|
||||||
PlayerInfo info;
|
PlayerInfo info;
|
||||||
if (myNetClient)
|
if (myNetClient)
|
||||||
info = myNetClient->GetPlayerInfo(playerId);
|
info = myNetClient->GetPlayerInfo(playerId);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerStats Session::getClientStats() const
|
ServerStats Session::getClientStats() const
|
||||||
{
|
{
|
||||||
ServerStats stats;
|
ServerStats stats;
|
||||||
if (myNetClient)
|
if (myNetClient)
|
||||||
stats = myNetClient->GetStatData();
|
stats = myNetClient->GetStatData();
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Session::getClientCurrentGameId() const
|
unsigned Session::getClientCurrentGameId() const
|
||||||
{
|
{
|
||||||
unsigned id = 0;
|
unsigned id = 0;
|
||||||
if (myNetClient)
|
if (myNetClient)
|
||||||
id = myNetClient->GetGameId();
|
id = myNetClient->GetGameId();
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Session::getClientUniquePlayerId() const
|
unsigned Session::getClientUniquePlayerId() const
|
||||||
{
|
{
|
||||||
unsigned id = 0;
|
unsigned id = 0;
|
||||||
if (myNetClient)
|
if (myNetClient)
|
||||||
id = myNetClient->GetGuiPlayerId();
|
id = myNetClient->GetGuiPlayerId();
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::getAvatarFile(const MD5Buf &avatarMD5, std::string &fileName)
|
bool Session::getAvatarFile(const MD5Buf &avatarMD5, std::string &fileName)
|
||||||
{
|
{
|
||||||
bool retVal = false;
|
bool retVal = false;
|
||||||
if (myAvatarManager.get())
|
if (myAvatarManager.get())
|
||||||
{
|
{
|
||||||
string tmpFileName;
|
string tmpFileName;
|
||||||
retVal = myAvatarManager->GetAvatarFileName(avatarMD5, tmpFileName);
|
retVal = myAvatarManager->GetAvatarFileName(avatarMD5, tmpFileName);
|
||||||
if (retVal)
|
if (retVal)
|
||||||
fileName = myQtToolsInterface->stringToUtf8(tmpFileName);
|
fileName = myQtToolsInterface->stringToUtf8(tmpFileName);
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+56
-56
@@ -41,85 +41,85 @@ class QtToolsInterface;
|
|||||||
class Session{
|
class Session{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Session(GuiInterface*, ConfigFile*);
|
Session(GuiInterface*, ConfigFile*);
|
||||||
|
|
||||||
~Session();
|
~Session();
|
||||||
|
|
||||||
enum GameType { GAME_TYPE_NONE, GAME_TYPE_LOCAL, GAME_TYPE_NETWORK, GAME_TYPE_INTERNET };
|
enum GameType { GAME_TYPE_NONE, GAME_TYPE_LOCAL, GAME_TYPE_NETWORK, GAME_TYPE_INTERNET };
|
||||||
|
|
||||||
// Only one of the two inits should be called.
|
// Only one of the two inits should be called.
|
||||||
bool init();
|
bool init();
|
||||||
void init(boost::shared_ptr<AvatarManager> manager);
|
void init(boost::shared_ptr<AvatarManager> manager);
|
||||||
|
|
||||||
void addOwnAvatar(const std::string &avatarFile);
|
void addOwnAvatar(const std::string &avatarFile);
|
||||||
|
|
||||||
void startLocalGame(const GameData &gameData, const StartData &startData);
|
void startLocalGame(const GameData &gameData, const StartData &startData);
|
||||||
void startClientGame(boost::shared_ptr<Game> game);
|
void startClientGame(boost::shared_ptr<Game> game);
|
||||||
|
|
||||||
Game *getCurrentGame();
|
Game *getCurrentGame();
|
||||||
GuiInterface *getGui();
|
GuiInterface *getGui();
|
||||||
GameType getGameType();
|
GameType getGameType();
|
||||||
|
|
||||||
boost::shared_ptr<AvatarManager> getAvatarManager();
|
boost::shared_ptr<AvatarManager> getAvatarManager();
|
||||||
|
|
||||||
void startInternetClient();
|
void startInternetClient();
|
||||||
void startNetworkClient(const std::string &serverAddress, unsigned serverPort, bool ipv6, bool sctp);
|
void startNetworkClient(const std::string &serverAddress, unsigned serverPort, bool ipv6, bool sctp);
|
||||||
void startNetworkClientForLocalServer(const GameData &gameData);
|
void startNetworkClientForLocalServer(const GameData &gameData);
|
||||||
void terminateNetworkClient();
|
void terminateNetworkClient();
|
||||||
void clientCreateGame(const GameData &gameData, const std::string &name, const std::string &password);
|
void clientCreateGame(const GameData &gameData, const std::string &name, const std::string &password);
|
||||||
void clientJoinGame(unsigned gameId, const std::string &password);
|
void clientJoinGame(unsigned gameId, const std::string &password);
|
||||||
|
|
||||||
void startNetworkServer(bool dedicated);
|
void startNetworkServer(bool dedicated);
|
||||||
void sendLeaveCurrentGame();
|
void sendLeaveCurrentGame();
|
||||||
void sendStartEvent(bool fillUpWithCpuPlayers);
|
void sendStartEvent(bool fillUpWithCpuPlayers);
|
||||||
void terminateNetworkServer();
|
void terminateNetworkServer();
|
||||||
bool pollNetworkServerTerminated();
|
bool pollNetworkServerTerminated();
|
||||||
|
|
||||||
void sendClientPlayerAction();
|
void sendClientPlayerAction();
|
||||||
|
|
||||||
void sendGameChatMessage(const std::string &message);
|
void sendGameChatMessage(const std::string &message);
|
||||||
void sendLobbyChatMessage(const std::string &message);
|
void sendLobbyChatMessage(const std::string &message);
|
||||||
void kickPlayer(unsigned playerId);
|
void kickPlayer(unsigned playerId);
|
||||||
void kickPlayer(const std::string &playerName);
|
void kickPlayer(const std::string &playerName);
|
||||||
void startVoteKickPlayer(unsigned playerId);
|
void startVoteKickPlayer(unsigned playerId);
|
||||||
void voteKick(bool doKick);
|
void voteKick(bool doKick);
|
||||||
void selectServer(unsigned serverId);
|
void selectServer(unsigned serverId);
|
||||||
void setLogin(const std::string &userName, const std::string &password, bool isGuest);
|
void setLogin(const std::string &userName, const std::string &password, bool isGuest);
|
||||||
|
|
||||||
void invitePlayerToCurrentGame(unsigned playerId);
|
void invitePlayerToCurrentGame(unsigned playerId);
|
||||||
void acceptGameInvitation(unsigned gameId);
|
void acceptGameInvitation(unsigned gameId);
|
||||||
void rejectGameInvitation(unsigned gameId, DenyGameInvitationReason reason);
|
void rejectGameInvitation(unsigned gameId, DenyGameInvitationReason reason);
|
||||||
|
|
||||||
void resetNetworkTimeout();
|
void resetNetworkTimeout();
|
||||||
|
|
||||||
bool isNetworkClientRunning() const; // TODO hack
|
bool isNetworkClientRunning() const; // TODO hack
|
||||||
bool isNetworkServerRunning() const; // TODO hack
|
bool isNetworkServerRunning() const; // TODO hack
|
||||||
|
|
||||||
ServerInfo getClientServerInfo(unsigned serverId) const;
|
ServerInfo getClientServerInfo(unsigned serverId) const;
|
||||||
GameInfo getClientGameInfo(unsigned gameId) const;
|
GameInfo getClientGameInfo(unsigned gameId) const;
|
||||||
PlayerInfo getClientPlayerInfo(unsigned playerId) const;
|
PlayerInfo getClientPlayerInfo(unsigned playerId) const;
|
||||||
ServerStats getClientStats() const;
|
ServerStats getClientStats() const;
|
||||||
unsigned getClientCurrentGameId() const;
|
unsigned getClientCurrentGameId() const;
|
||||||
unsigned getClientUniquePlayerId() const;
|
unsigned getClientUniquePlayerId() const;
|
||||||
|
|
||||||
bool getAvatarFile(const MD5Buf &avatarMD5, std::string &fileName);
|
bool getAvatarFile(const MD5Buf &avatarMD5, std::string &fileName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int currentGameNum;
|
int currentGameNum;
|
||||||
|
|
||||||
std::string myIrcNick;
|
std::string myIrcNick;
|
||||||
|
|
||||||
boost::shared_ptr<ClientThread> myNetClient;
|
boost::shared_ptr<ClientThread> myNetClient;
|
||||||
boost::shared_ptr<ServerManager> myNetServer;
|
boost::shared_ptr<ServerManager> myNetServer;
|
||||||
|
|
||||||
boost::shared_ptr<AvatarManager> myAvatarManager;
|
boost::shared_ptr<AvatarManager> myAvatarManager;
|
||||||
|
|
||||||
boost::shared_ptr<Game> currentGame;
|
boost::shared_ptr<Game> currentGame;
|
||||||
GuiInterface *myGui;
|
GuiInterface *myGui;
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
GameType myGameType;
|
GameType myGameType;
|
||||||
QtToolsInterface *myQtToolsInterface;
|
QtToolsInterface *myQtToolsInterface;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user