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 server...


From: Philippe Fremy
Subject: [Camino-devel] camino/src client/Game.cpp client/Game.h server...
Date: Sun, 02 Mar 2003 11:31:29 -0500

CVSROOT:        /cvsroot/camino
Module name:    camino
Changes by:     Philippe Fremy <address@hidden> 03/03/02 11:31:28

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

Log message:
        Camino servers now update clients about played tiles

Patches:
Index: camino/src/client/Game.cpp
diff -u camino/src/client/Game.cpp:1.23 camino/src/client/Game.cpp:1.24
--- camino/src/client/Game.cpp:1.23     Fri Feb 28 07:40:53 2003
+++ camino/src/client/Game.cpp  Sun Mar  2 11:31:28 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: Game.cpp,v 1.23 2003/02/28 12:40:53 pfremy Exp $
+** Version : $Id: Game.cpp,v 1.24 2003/03/02 16:31:28 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
@@ -265,3 +265,10 @@
        // tile to the board.
 }
 
+void Game::recvUpdateBoard( Tile * tile, bool removeIt )
+{
+       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
+}
Index: camino/src/client/Game.h
diff -u camino/src/client/Game.h:1.16 camino/src/client/Game.h:1.17
--- camino/src/client/Game.h:1.16       Thu Feb 27 14:34:07 2003
+++ camino/src/client/Game.h    Sun Mar  2 11:31:28 2003
@@ -5,7 +5,7 @@
 ** Game.h
 ** Main widget of the game
 **
-** Version : $Id: Game.h,v 1.16 2003/02/27 19:34:07 pfremy Exp $
+** Version : $Id: Game.h,v 1.17 2003/03/02 16:31:28 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -91,6 +91,7 @@
        virtual void recvMsg( QString source, QString msg );
        virtual void recvTilesForYou( Tile::TileType tile );
        virtual void recvActivePlayer( QString playerName );
+       virtual void recvUpdateBoard( Tile * tile, bool removeIt );
 
 signals:
        void sig_connected( bool );
Index: camino/src/server/CaminoServer.cpp
diff -u camino/src/server/CaminoServer.cpp:1.15 
camino/src/server/CaminoServer.cpp:1.16
--- camino/src/server/CaminoServer.cpp:1.15     Fri Feb 28 07:52:54 2003
+++ camino/src/server/CaminoServer.cpp  Sun Mar  2 11:31:28 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: CaminoServer.cpp,v 1.15 2003/02/28 12:52:54 pfremy Exp $
+** Version : $Id: CaminoServer.cpp,v 1.16 2003/03/02 16:31:28 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 19/01/2003
@@ -169,3 +169,14 @@
        serverBroadcastMsg( InfoMsg, "Tiles distributed!" );
 }
 
+void CaminoServer::updateBoard( Tile * tile, bool removeIt )
+{
+       // add tile to the board
+       // update the clients about the new tile
+       Player * player;
+       QPtrListIterator<Player> it( _playerList );
+       while(  ( player = it.current() ) ) {
+               player->sendUpdateBoard( tile, removeIt );
+               ++it;
+       }
+}
Index: camino/src/server/CaminoServer.h
diff -u camino/src/server/CaminoServer.h:1.12 
camino/src/server/CaminoServer.h:1.13
--- camino/src/server/CaminoServer.h:1.12       Fri Feb 28 07:52:54 2003
+++ camino/src/server/CaminoServer.h    Sun Mar  2 11:31:28 2003
@@ -5,7 +5,7 @@
 ** CaminoServer.h
 ** Server for the game
 **
-** Version : $Id: CaminoServer.h,v 1.12 2003/02/28 12:52:54 pfremy Exp $
+** Version : $Id: CaminoServer.h,v 1.13 2003/03/02 16:31:28 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 19/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -85,6 +85,7 @@
        void distributeTiles();
        void sendDistributedTiles();
        void activateNextPlayer();
+       void updateBoard( Tile * tile, bool removeIt = false );
 
 signals:
        void sig_newConnection( QSocket * );
Index: camino/src/server/Player.cpp
diff -u camino/src/server/Player.cpp:1.12 camino/src/server/Player.cpp:1.13
--- camino/src/server/Player.cpp:1.12   Fri Feb 28 07:52:54 2003
+++ camino/src/server/Player.cpp        Sun Mar  2 11:31:28 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: Player.cpp,v 1.12 2003/02/28 12:52:54 pfremy Exp $
+** Version : $Id: Player.cpp,v 1.13 2003/03/02 16:31:28 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
@@ -84,7 +84,7 @@
        _server->broadcastMsg( _subtype, source, msg );
 }
 
-void Player::recvPlayerPlaysAMove( Tile * /* tile */ )
+void Player::recvPlayerPlaysAMove( Tile * tile )
 {
        QString msg;
        if (this != _server->_activePlayer) {
@@ -94,10 +94,9 @@
                return;
        }
 
-       // check that move is valid
+       // check that the move is valid
        // remove tile from player set
-       // add tile to the board
-       // update the clients about the new tile
+       _server->updateBoard( tile );   
        // distribute new tile to previous player
        // activate new player
        _server->activateNextPlayer();




reply via email to

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