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