From 2a7fc827f4eb398bba3c5adb61743406a819181c Mon Sep 17 00:00:00 2001 From: Kevin Boxhoorn Date: Mon, 3 Oct 2016 12:33:40 +1100 Subject: [PATCH 1/5] Add `getIsLocalGame` to `TabGame` --- cockatrice/src/tab_game.cpp | 6 ++++-- cockatrice/src/tab_game.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/tab_game.cpp b/cockatrice/src/tab_game.cpp index 9971e77c..84e14e33 100644 --- a/cockatrice/src/tab_game.cpp +++ b/cockatrice/src/tab_game.cpp @@ -316,7 +316,8 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay) replay(_replay), currentReplayStep(0), sayLabel(0), - sayEdit(0) + sayEdit(0), + isLocalGame(_tabSupervisor->getIsLocalGame()) { // THIS CTOR IS USED ON REPLAY gameInfo.CopyFrom(replay->game_info()); @@ -382,7 +383,8 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList &_client activeCard(0), gameClosed(false), replay(0), - replayDock(0) + replayDock(0), + isLocalGame(_tabSupervisor->getIsLocalGame()) { // THIS CTOR IS USED ON GAMES gameInfo.set_started(false); diff --git a/cockatrice/src/tab_game.h b/cockatrice/src/tab_game.h index 52644583..1cd40e42 100644 --- a/cockatrice/src/tab_game.h +++ b/cockatrice/src/tab_game.h @@ -111,6 +111,7 @@ private: QMap roomGameTypes; int hostId; int localPlayerId; + bool isLocalGame; bool spectator; QMap players; QMap spectators; @@ -238,6 +239,7 @@ public: const QMap &getPlayers() const { return players; } CardItem *getCard(int playerId, const QString &zoneName, int cardId) const; bool isHost() const { return hostId == localPlayerId; } + bool getIsLocalGame() const { return isLocalGame; } int getGameId() const { return gameInfo.game_id(); } QString getTabText() const; bool getSpectator() const { return spectator; } From 3680f409813c6b020052a3f791f700c7d28bec46 Mon Sep 17 00:00:00 2001 From: Kevin Boxhoorn Date: Mon, 3 Oct 2016 12:35:44 +1100 Subject: [PATCH 2/5] Disable "Load remote deck..." button in local game --- cockatrice/src/tab_game.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cockatrice/src/tab_game.cpp b/cockatrice/src/tab_game.cpp index 84e14e33..4233108d 100644 --- a/cockatrice/src/tab_game.cpp +++ b/cockatrice/src/tab_game.cpp @@ -100,6 +100,8 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent) { loadLocalButton = new QPushButton; loadRemoteButton = new QPushButton; + if (parentGame->getIsLocalGame()) + loadRemoteButton->setEnabled(false); readyStartButton = new ToggleButton; readyStartButton->setEnabled(false); sideboardLockButton = new ToggleButton; From c1aebc1af5f8996da14b3a9c2f4ec6ca135c841e Mon Sep 17 00:00:00 2001 From: Kevin Boxhoorn Date: Mon, 3 Oct 2016 13:16:16 +1100 Subject: [PATCH 3/5] Fix member variable initialization order --- cockatrice/src/tab_game.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cockatrice/src/tab_game.cpp b/cockatrice/src/tab_game.cpp index 4233108d..ee9c601a 100644 --- a/cockatrice/src/tab_game.cpp +++ b/cockatrice/src/tab_game.cpp @@ -309,6 +309,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay) secondsElapsed(0), hostId(-1), localPlayerId(-1), + isLocalGame(_tabSupervisor->getIsLocalGame()), spectator(true), gameStateKnown(false), resuming(false), @@ -318,8 +319,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay) replay(_replay), currentReplayStep(0), sayLabel(0), - sayEdit(0), - isLocalGame(_tabSupervisor->getIsLocalGame()) + sayEdit(0) { // THIS CTOR IS USED ON REPLAY gameInfo.CopyFrom(replay->game_info()); @@ -378,6 +378,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList &_client roomGameTypes(_roomGameTypes), hostId(event.host_id()), localPlayerId(event.player_id()), + isLocalGame(_tabSupervisor->getIsLocalGame()), spectator(event.spectator()), gameStateKnown(false), resuming(event.resuming()), @@ -385,8 +386,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList &_client activeCard(0), gameClosed(false), replay(0), - replayDock(0), - isLocalGame(_tabSupervisor->getIsLocalGame()) + replayDock(0) { // THIS CTOR IS USED ON GAMES gameInfo.set_started(false); From 2376a7dbc01aeabef6f3b4e723f27225c5cf740c Mon Sep 17 00:00:00 2001 From: Kevin Boxhoorn Date: Wed, 5 Oct 2016 09:43:22 +1100 Subject: [PATCH 4/5] Make `isLocalGame` const --- cockatrice/src/tab_game.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cockatrice/src/tab_game.h b/cockatrice/src/tab_game.h index 1cd40e42..213d5e92 100644 --- a/cockatrice/src/tab_game.h +++ b/cockatrice/src/tab_game.h @@ -111,7 +111,7 @@ private: QMap roomGameTypes; int hostId; int localPlayerId; - bool isLocalGame; + const bool isLocalGame; bool spectator; QMap players; QMap spectators; From d8f7c57eff4143afc7890d70a2e0c3f29e46ed91 Mon Sep 17 00:00:00 2001 From: ctrlaltca Date: Wed, 5 Oct 2016 14:24:50 +0200 Subject: [PATCH 5/5] Fixed travis build on osx --- travis-dependencies.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/travis-dependencies.sh b/travis-dependencies.sh index cd63a416..13bdc727 100755 --- a/travis-dependencies.sh +++ b/travis-dependencies.sh @@ -3,8 +3,6 @@ if [[ $TRAVIS_OS_NAME == "osx" ]] ; then brew update > /dev/null brew install qt5 protobuf > /dev/null - brew unlink cmake - brew upgrade cmake else # common prerequisites sudo add-apt-repository -y ppa:smspillaz/cmake-master @@ -29,4 +27,4 @@ else sudo ln -s /usr/src/gtest/build/libgtest_main.so /usr/lib/libgtest_main.so cd - fi -fi \ No newline at end of file +fi