camino-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Camino-devel] camino/src client/Game.cpp client/Game.h client...


From: Philippe Fremy
Subject: [Camino-devel] camino/src client/Game.cpp client/Game.h client...
Date: Sun, 02 Mar 2003 12:07:21 -0500

CVSROOT:        /cvsroot/camino
Module name:    camino
Changes by:     Philippe Fremy <address@hidden> 03/03/02 12:07:19

Modified files:
        src/client     : Game.cpp Game.h TilePresentation.cpp 
                         TilePresentation.h 
        src/server     : Player.cpp 

Log message:
        rejected move now tested and properly handled

Patches:
Index: camino/src/client/Game.cpp
diff -u camino/src/client/Game.cpp:1.25 camino/src/client/Game.cpp:1.26
--- camino/src/client/Game.cpp:1.25     Sun Mar  2 11:46:02 2003
+++ camino/src/client/Game.cpp  Sun Mar  2 12:07:18 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: Game.cpp,v 1.25 2003/03/02 16:46:02 pfremy Exp $
+** Version : $Id: Game.cpp,v 1.26 2003/03/02 17:07:18 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
@@ -29,6 +29,7 @@
 #include <qvbox.h>
 #include <qlabel.h>
 #include <qsocket.h>
+#include <qmessagebox.h>
 
 // application specific include files
 #include "common/log.h"
@@ -256,6 +257,7 @@
        // check if there is no tile at this place: ask board to do that
        // check if the rule allow to play here: ask board to do that
 
+       _tilePresentation->getSelected()->setPosition( row, col );
        sendPlayerPlaysAMove( _tilePresentation->getSelected() );       
 
        _tilePresentation->removeSelectedTile();
@@ -266,5 +268,13 @@
        qDebug("Game::recvUpdateBoard - %s tile %d at %dx%d", 
                        removeIt ? "remove" : "add" , 
                        tile->getType(), tile->getRow(), tile->getCol() );
-       // add or reomve the tile to the board
+       // add or remove the tile to the board
+}
+       
+void Game::recvMoveRejected( Tile * tile )
+{
+       qDebug("Game::recvMoveRejected");
+       QMessageBox::warning( this, "Move rejected", "The Camino Server has 
rejected your last move.\nYou must play another move." );
+       _tilePresentation->addTile( tile );
+       _tilePresentation->setSelected( tile );
 }
Index: camino/src/client/Game.h
diff -u camino/src/client/Game.h:1.18 camino/src/client/Game.h:1.19
--- camino/src/client/Game.h:1.18       Sun Mar  2 11:46:02 2003
+++ camino/src/client/Game.h    Sun Mar  2 12:07:18 2003
@@ -5,7 +5,7 @@
 ** Game.h
 ** Main widget of the game
 **
-** Version : $Id: Game.h,v 1.18 2003/03/02 16:46:02 pfremy Exp $
+** Version : $Id: Game.h,v 1.19 2003/03/02 17:07:18 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -92,6 +92,7 @@
        virtual void recvTilesForYou( Tile::TileType tile );
        virtual void recvActivePlayer( QString playerName );
        virtual void recvUpdateBoard( Tile * tile, bool removeIt );
+       virtual void recvMoveRejected( Tile * tile );
 
 signals:
        void sig_connected( bool );
Index: camino/src/client/TilePresentation.cpp
diff -u camino/src/client/TilePresentation.cpp:1.9 
camino/src/client/TilePresentation.cpp:1.10
--- camino/src/client/TilePresentation.cpp:1.9  Sun Mar  2 11:46:02 2003
+++ camino/src/client/TilePresentation.cpp      Sun Mar  2 12:07:18 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: TilePresentation.cpp,v 1.9 2003/03/02 16:46:02 pfremy Exp $
+** Version : $Id: TilePresentation.cpp,v 1.10 2003/03/02 17:07:18 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 28/01/2003
@@ -124,6 +124,10 @@
        return _selectedTileButton->getTile(); 
 }
 
+void TilePresentation::setSelected( Tile * tile )
+{
+       _selectedTileButton->setTile( tile );
+}
 //
 // ----- TileButton -----
 //
Index: camino/src/client/TilePresentation.h
diff -u camino/src/client/TilePresentation.h:1.8 
camino/src/client/TilePresentation.h:1.9
--- camino/src/client/TilePresentation.h:1.8    Thu Feb 27 12:54:22 2003
+++ camino/src/client/TilePresentation.h        Sun Mar  2 12:07:18 2003
@@ -5,7 +5,7 @@
 ** TilePresentation.h
 ** Displays tiles of the player
 **
-** Version : $Id: TilePresentation.h,v 1.8 2003/02/27 17:54:22 pfremy Exp $
+** Version : $Id: TilePresentation.h,v 1.9 2003/03/02 17:07:18 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 28/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -58,6 +58,7 @@
        void removeTile( Tile * tile );
        void removeSelectedTile();
        Tile * getSelected();
+       void setSelected( Tile * tile );
 
 public slots:
        void slot_selectTile( int num );
Index: camino/src/server/Player.cpp
diff -u camino/src/server/Player.cpp:1.13 camino/src/server/Player.cpp:1.14
--- camino/src/server/Player.cpp:1.13   Sun Mar  2 11:31:28 2003
+++ camino/src/server/Player.cpp        Sun Mar  2 12:07:19 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: Player.cpp,v 1.13 2003/03/02 16:31:28 pfremy Exp $
+** Version : $Id: Player.cpp,v 1.14 2003/03/02 17:07:19 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
@@ -93,6 +93,15 @@
                qDebug("Player::recvPlayerPlaysAMove - %s", msg.latin1() );
                return;
        }
+
+       /*
+       static bool rejectsMove = true;
+       rejectsMove = ! rejectsMove;
+
+       if (rejectsMove) {
+               sendMoveRejected( tile );
+       } else {
+       */
 
        // check that the move is valid
        // remove tile from player set




reply via email to

[Prev in Thread] Current Thread [Next in Thread]