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 Game.h


From: Pascal Audoux
Subject: [Camino-devel] camino/src/client Game.cpp Game.h
Date: Sun, 02 Mar 2003 16:34:12 -0500

CVSROOT:        /cvsroot/camino
Module name:    camino
Changes by:     Pascal Audoux <address@hidden>  03/03/02 16:34:12

Modified files:
        src/client     : Game.cpp Game.h 

Log message:
        implement recvUpdateBoard, reupdateBoard

Patches:
Index: camino/src/client/Game.cpp
diff -u camino/src/client/Game.cpp:1.26 camino/src/client/Game.cpp:1.27
--- camino/src/client/Game.cpp:1.26     Sun Mar  2 12:07:18 2003
+++ camino/src/client/Game.cpp  Sun Mar  2 16:34:12 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: Game.cpp,v 1.26 2003/03/02 17:07:18 pfremy Exp $
+** Version : $Id: Game.cpp,v 1.27 2003/03/02 21:34:12 Audoux Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
@@ -95,7 +95,8 @@
 void Game::reupdate()
 {
        //_actions->reupdate();
-       //_board->reupdate();
+
+       _board->reupdate();
        _tilePresentation->reupdate();
 }
 
@@ -125,11 +126,6 @@
        _chat->newMessage( msg );
 }
 
-void Game::addTile( Tile * tile )
-{
-       _board->addTile( tile );
-}
-
 void Game::slot_play()
 {
        // play something
@@ -213,7 +209,7 @@
 void Game::slotDecode()
 {
 //     qDebug( "Game::slotDecode()" );
-       while( _socket->bytesAvailable() ) { 
+       while( _socket->bytesAvailable() ) {
                MsgDecoder::slotDecode();
 //             qDebug( "bytes available : %ld", _socket->bytesAvailable() );
        }
@@ -242,8 +238,23 @@
        displayServerMsg( playerName + " is now the active player" );
 }
 
+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 remove the tile to the board
+
+       if( removeIt ) {
+               _board->removeTile( tile );
+       } else {
+               _board->addTile( tile );
+       }
+}
+
 void Game::slot_tileClickedInBoard( int row, int col )
 {
+
        // check if we have one tile selected in tile presentation
        if (_tilePresentation->getSelected() == 0L) {
                return;
@@ -258,19 +269,12 @@
        // check if the rule allow to play here: ask board to do that
 
        _tilePresentation->getSelected()->setPosition( row, col );
-       sendPlayerPlaysAMove( _tilePresentation->getSelected() );       
+       sendPlayerPlaysAMove( _tilePresentation->getSelected() );
+
 
        _tilePresentation->removeSelectedTile();
 }
 
-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 remove the tile to the board
-}
-       
 void Game::recvMoveRejected( Tile * tile )
 {
        qDebug("Game::recvMoveRejected");
Index: camino/src/client/Game.h
diff -u camino/src/client/Game.h:1.19 camino/src/client/Game.h:1.20
--- camino/src/client/Game.h:1.19       Sun Mar  2 12:07:18 2003
+++ camino/src/client/Game.h    Sun Mar  2 16:34:12 2003
@@ -5,7 +5,7 @@
 ** Game.h
 ** Main widget of the game
 **
-** Version : $Id: Game.h,v 1.19 2003/03/02 17:07:18 pfremy Exp $
+** Version : $Id: Game.h,v 1.20 2003/03/02 21:34:12 Audoux Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -61,12 +61,13 @@
 
        void reupdate();
        void displayServerMsg( const QString & msg );
-       void addTile( Tile * tile );
 
        // send messages to server
        void sendMessage( NetMsgSubtype msgLevel, const QString & msg );
        void sendUndo();
 
+signals:
+       void sig_connected( bool );
 
 public slots:
        void slot_chatMessage( const QString & msg );
@@ -94,10 +95,6 @@
        virtual void recvUpdateBoard( Tile * tile, bool removeIt );
        virtual void recvMoveRejected( Tile * tile );
 
-signals:
-       void sig_connected( bool );
-
-protected:
        ActionList * _actions;
        TilePresentation * _tilePresentation;
        BoardCanvas * _board;




reply via email to

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