camino-devel
[Top][All Lists]
Advanced

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

[Camino-devel] camino/src/client ClientEngine.cpp ClientEngine...


From: Philippe Fremy
Subject: [Camino-devel] camino/src/client ClientEngine.cpp ClientEngine...
Date: Tue, 18 Feb 2003 18:16:06 -0500

CVSROOT:        /cvsroot/camino
Module name:    camino
Changes by:     Philippe Fremy <address@hidden> 03/02/18 18:16:06

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

Log message:
        received tiles are passed to presentation

Patches:
Index: camino/src/client/ClientEngine.cpp
diff -u camino/src/client/ClientEngine.cpp:1.13 
camino/src/client/ClientEngine.cpp:1.14
--- camino/src/client/ClientEngine.cpp:1.13     Tue Feb 18 17:18:27 2003
+++ camino/src/client/ClientEngine.cpp  Tue Feb 18 18:16:06 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: ClientEngine.cpp,v 1.13 2003/02/18 22:18:27 Audoux Exp $
+** Version : $Id: ClientEngine.cpp,v 1.14 2003/02/18 23:16:06 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
@@ -29,6 +29,7 @@
 #include "ClientEngine.h"
 #include "Game.h"
 #include "common/MsgCoder.h"
+#include "common/Tile.h"
 
 
 /** add comments here */
@@ -132,8 +133,8 @@
        }
 }
 
-void ClientEngine::recvTile( Tile::TileType tile )
+void ClientEngine::recvTilesForYou( Tile::TileType tile )
 {
        qDebug( "ClientEngine::recvTile - %d", ( int )tile );
-       //_game->addTile( tile, rotation );
+       emit sig_recvTile( tile );
 }
Index: camino/src/client/ClientEngine.h
diff -u camino/src/client/ClientEngine.h:1.11 
camino/src/client/ClientEngine.h:1.12
--- camino/src/client/ClientEngine.h:1.11       Tue Feb 18 17:18:27 2003
+++ camino/src/client/ClientEngine.h    Tue Feb 18 18:16:06 2003
@@ -5,7 +5,7 @@
 ** ClientEngine.h
 ** The intelligence of the client is here
 **
-** Version : $Id: ClientEngine.h,v 1.11 2003/02/18 22:18:27 Audoux Exp $
+** Version : $Id: ClientEngine.h,v 1.12 2003/02/18 23:16:06 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -43,8 +43,6 @@
  *                         ClientEngine
  *              ------------------------------ */
 
-
-
 /** comment for the class */
 class ClientEngine : public MsgDecoder, public MsgCoder
 {
@@ -61,7 +59,7 @@
        bool isConnected();
 
        void recvMsg( QString source, QString msg );
-       void recvTile( Tile::TileType tile );
+       void recvTilesForYou( Tile::TileType tile );
 
        void sendMessage( NetMsgSubtype msgLevel, const QString & msg );
 
@@ -73,8 +71,8 @@
 
 signals:
        void sig_message( const QString & msg );
-
        void sig_connected( bool );
+       void sig_recvTile( Tile::TileType type );
 
 protected slots:
        void slotServerConnected();
@@ -93,7 +91,6 @@
        QSocket * _socket;
        QString _playerName;
        Game * _game;
-
 };
  
 #endif // CLIENT_ENGINE_H   
Index: camino/src/client/Game.cpp
diff -u camino/src/client/Game.cpp:1.15 camino/src/client/Game.cpp:1.16
--- camino/src/client/Game.cpp:1.15     Tue Feb 18 17:18:27 2003
+++ camino/src/client/Game.cpp  Tue Feb 18 18:16:06 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: Game.cpp,v 1.15 2003/02/18 22:18:27 Audoux Exp $
+** Version : $Id: Game.cpp,v 1.16 2003/02/18 23:16:06 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
@@ -50,12 +50,13 @@
        layout->setAutoAdd( true );
        layout->activate();
 
-
        QVBox * vbox = new QVBox( this );
        vbox->setSpacing( 10 );
+
        _playerLabel = new QLabel( "Not connected", vbox );
        _playerLabel->setAlignment( AlignHCenter );
        slot_clientConnected( false ); // sets the text of the label
+
        QHBox * hbox = new QHBox( vbox );
        hbox->setSpacing( 10 );
        _presentation = new TilePresentation( hbox );
@@ -68,6 +69,9 @@
        connect( _engine, SIGNAL( sig_connected( bool ) ), SIGNAL( 
sig_connected( bool ) ) );
        connect( _engine, SIGNAL( sig_connected( bool ) ), SLOT( 
slot_clientConnected( bool ) ) );
 
+       connect( _engine, SIGNAL( sig_recvTile( Tile::TileType ) ),
+                       _presentation, SLOT( slot_recvTile( Tile::TileType ) ) 
);
+
        connect( _presentation, SIGNAL( sig_tile( int ) ), SLOT( slot_tile( int 
) ) );
        connect( _actions, SIGNAL( sig_play() ), SLOT( slot_play() ) );
        connect( _actions, SIGNAL( sig_complete() ), SLOT( slot_complete() ) );
@@ -124,7 +128,7 @@
 
 void Game::slot_play()
 {
-
+       // play something
 }
 
 void Game::slot_complete()
Index: camino/src/client/TilePresentation.cpp
diff -u camino/src/client/TilePresentation.cpp:1.3 
camino/src/client/TilePresentation.cpp:1.4
--- camino/src/client/TilePresentation.cpp:1.3  Wed Jan 29 14:42:03 2003
+++ camino/src/client/TilePresentation.cpp      Tue Feb 18 18:16:06 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: TilePresentation.cpp,v 1.3 2003/01/29 19:42:03 Audoux Exp $
+** Version : $Id: TilePresentation.cpp,v 1.4 2003/02/18 23:16:06 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 28/01/2003
@@ -62,17 +62,35 @@
 
 void TilePresentation::slot_toggle( int num )
 {
+       // untoggle previous toggled button
        if( _toggled != -1 ) {
                if( num != _toggled ) {
                        _buttons[_toggled]->toggle();
                }
        }
+
        if( num == _toggled ) {
                _toggled = -1;
        } else {
                _toggled = num;
        }
+
        emit sig_tile( _toggled );
+}
+
+void TilePresentation::slot_recvTile( Tile::TileType tile )
+{
+       // XXX should not hardcode button number
+       for( int i=0; i<6; i++) {
+               if (_buttons[i]->_type == Tile::TILE_UNKNOWN) {
+                       _buttons[i]->setTile( tile );
+                       qDebug("TilePresentation::slot_recvTile() - update 
button %d", i );
+                       return;
+               }
+       }
+       qDebug("TilePresentation::slot_recvTile() - Received a tile but all 
buttons are filled!");
+       qDebug("TilePresentation::slot_recvTile() - I discard the first one 
then");
+       _buttons[0]->setTile( tile );
 }
 
 //
Index: camino/src/client/TilePresentation.h
diff -u camino/src/client/TilePresentation.h:1.3 
camino/src/client/TilePresentation.h:1.4
--- camino/src/client/TilePresentation.h:1.3    Wed Jan 29 14:42:03 2003
+++ camino/src/client/TilePresentation.h        Tue Feb 18 18:16:06 2003
@@ -5,7 +5,7 @@
 ** TilePresentation.h
 ** Displays tiles of the player
 **
-** Version : $Id: TilePresentation.h,v 1.3 2003/01/29 19:42:03 Audoux Exp $
+** Version : $Id: TilePresentation.h,v 1.4 2003/02/18 23:16:06 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 28/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -56,6 +56,7 @@
 
 public slots:
        void slot_toggle( int num );
+       void slot_recvTile( Tile::TileType tile );
 
 signals:
        void sig_tile( int num );
@@ -75,7 +76,10 @@
        void reinit();
 
 protected:
+       
        Tile::TileType _type;
+
+friend class TilePresentation;
 };
 
 #endif // TILEPRESENTATION_H




reply via email to

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