From 4d0c9962f4602aa4d2e25e8449ef36fb250ea3b5 Mon Sep 17 00:00:00 2001 From: Max-Wilhelm Bruker Date: Tue, 7 Sep 2010 02:03:54 +0200 Subject: [PATCH] phase toolbar fixed --- cockatrice/src/phasestoolbar.cpp | 8 ++++---- cockatrice/src/phasestoolbar.h | 2 +- cockatrice/src/tab_game.cpp | 7 ++++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cockatrice/src/phasestoolbar.cpp b/cockatrice/src/phasestoolbar.cpp index c783573a..f26e6a5f 100644 --- a/cockatrice/src/phasestoolbar.cpp +++ b/cockatrice/src/phasestoolbar.cpp @@ -152,20 +152,20 @@ void PhasesToolbar::phaseButtonClicked() PhaseButton *button = qobject_cast(sender()); if (button->getActive()) button->triggerDoubleClickAction(); - emit sendGameCommand(new Command_SetActivePhase(-1, buttonList.indexOf(button))); + emit sendGameCommand(new Command_SetActivePhase(-1, buttonList.indexOf(button)), -1); } void PhasesToolbar::actNextTurn() { - emit sendGameCommand(new Command_NextTurn); + emit sendGameCommand(new Command_NextTurn, -1); } void PhasesToolbar::actUntapAll() { - emit sendGameCommand(new Command_SetCardAttr(-1, "table", -1, "tapped", "0")); + emit sendGameCommand(new Command_SetCardAttr(-1, "table", -1, "tapped", "0"), -1); } void PhasesToolbar::actDrawCard() { - emit sendGameCommand(new Command_DrawCards(-1, 1)); + emit sendGameCommand(new Command_DrawCards(-1, 1), -1); } diff --git a/cockatrice/src/phasestoolbar.h b/cockatrice/src/phasestoolbar.h index 95555c0d..5f0acf8d 100644 --- a/cockatrice/src/phasestoolbar.h +++ b/cockatrice/src/phasestoolbar.h @@ -45,7 +45,7 @@ private slots: void actUntapAll(); void actDrawCard(); signals: - void sendGameCommand(GameCommand *command); + void sendGameCommand(GameCommand *command, int playerId); }; #endif diff --git a/cockatrice/src/tab_game.cpp b/cockatrice/src/tab_game.cpp index dc7db9b7..770561a0 100644 --- a/cockatrice/src/tab_game.cpp +++ b/cockatrice/src/tab_game.cpp @@ -384,8 +384,10 @@ void TabGame::processGameEventContainer(GameEventContainer *cont) void TabGame::sendGameCommand(GameCommand *command, int playerId) { + if (playerId == -1) + playerId = getActiveLocalPlayer()->getId(); + command->setGameId(gameId); - AbstractClient *client; if (clients.size() > 1) client = clients.at(playerId); @@ -396,6 +398,9 @@ void TabGame::sendGameCommand(GameCommand *command, int playerId) void TabGame::sendCommandContainer(CommandContainer *cont, int playerId) { + if (playerId == -1) + playerId = getActiveLocalPlayer()->getId(); + const QList &cmdList = cont->getCommandList(); for (int i = 0; i < cmdList.size(); ++i) { GameCommand *cmd = qobject_cast(cmdList[i]);