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 common/MsgCo...


From: Philippe Fremy
Subject: [Camino-devel] camino/src client/ClientEngine.cpp common/MsgCo...
Date: Tue, 18 Feb 2003 13:43:20 -0500

CVSROOT:        /cvsroot/camino
Module name:    camino
Changes by:     Philippe Fremy <address@hidden> 03/02/18 13:43:20

Modified files:
        src/client     : ClientEngine.cpp 
        src/common     : MsgCoder.cpp MsgCoder.h MsgDecoder.cpp 
                         MsgDecoder.h PhilTestRunner.cpp 
        src/server     : Player.cpp TestCaminoServer.h 

Log message:
        on arrive enfin a recevoir les message de tiles distribues

Patches:
Index: camino/src/client/ClientEngine.cpp
diff -u camino/src/client/ClientEngine.cpp:1.10 
camino/src/client/ClientEngine.cpp:1.11
--- camino/src/client/ClientEngine.cpp:1.10     Mon Feb 17 19:11:50 2003
+++ camino/src/client/ClientEngine.cpp  Tue Feb 18 13:43:20 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: ClientEngine.cpp,v 1.10 2003/02/18 00:11:50 pfremy Exp $
+** Version : $Id: ClientEngine.cpp,v 1.11 2003/02/18 18:43:20 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
@@ -118,8 +118,8 @@
 //     qDebug( "ClientEngine::slotDecode()" );
        MsgDecoder::slotDecode();
 
-//     qDebug( "bytes available : %ld", _socket->bytesAvailable() );
-       if ( _socket->bytesAvailable() ) { 
+       qDebug( "bytes available : %ld", _socket->bytesAvailable() );
+       while( _socket->bytesAvailable() ) { 
                MsgDecoder::slotDecode();
        }
 }
Index: camino/src/common/MsgCoder.cpp
diff -u camino/src/common/MsgCoder.cpp:1.7 camino/src/common/MsgCoder.cpp:1.8
--- camino/src/common/MsgCoder.cpp:1.7  Mon Feb 17 19:11:50 2003
+++ camino/src/common/MsgCoder.cpp      Tue Feb 18 13:43:20 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: MsgCoder.cpp,v 1.7 2003/02/18 00:11:50 pfremy Exp $
+** Version : $Id: MsgCoder.cpp,v 1.8 2003/02/18 18:43:20 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
@@ -54,14 +54,130 @@
        device()->flush();
 }
 
-void MsgCoder::sendUndo()
+void MsgCoder::sendTile( Tile::TileType tile )
+{
+       sendTilesForYou( tile );
+}
+
+void MsgCoder::sendTilesForYou( Tile::TileType tile )
+{
+       *this << TilesForYou << 0 << ( int ) tile ;
+       device()->flush();
+}
+
+void MsgCoder::sendServerInformation()
+{
+       *this << ServerInformation;
+       device()->flush();
+}
+void MsgCoder::sendPlayerConnected()
+{
+       *this << PlayerConnected;
+       device()->flush();
+}
+void MsgCoder::sendTeamIsBeingChosen()
+{
+       *this << TeamIsBeingChosen;
+       device()->flush();
+}
+void MsgCoder::sendTeamsComposition()
+{
+       *this << TeamsComposition;
+       device()->flush();
+}
+
+void MsgCoder::sendTilesForYou()
+{
+       *this << TilesForYou;
+       device()->flush();
+}
+void MsgCoder::sendActivePlayer()
+{
+       *this << ActivePlayer;
+       device()->flush();
+}
+void MsgCoder::sendPlayerPlaysAMove()
+{
+       *this << PlayerPlaysAMove;
+       device()->flush();
+}
+void MsgCoder::sendMoveRejected()
+{
+       *this << MoveRejected;
+       device()->flush();
+}
+void MsgCoder::sendUpdateBoard()
+{
+       *this << UpdateBoard;
+       device()->flush();
+}
+
+void MsgCoder::sendUndoRequest()
 {
        *this << UndoRequest;
        device()->flush();
 }
+void MsgCoder::sendUndoAccepted()
+{
+       *this << UndoAccepted;
+       device()->flush();
+}
+void MsgCoder::sendUndoRejected()
+{
+       *this << UndoRejected;
+       device()->flush();
+}
+void MsgCoder::sendUndoUpdateBoard()
+{
+       *this << UndoUpdateBoard;
+       device()->flush();
+}
 
-void MsgCoder::sendTile( Tile::TileType tile )
+void MsgCoder::sendEndOfGameRequest()
 {
-       *this << TilesForYou << ( int ) tile ;
+       *this << EndOfGameRequest;
        device()->flush();
 }
+void MsgCoder::sendEndOfGameAccepted()
+{
+       *this << EndOfGameAccepted;
+       device()->flush();
+}
+void MsgCoder::sendEndOfGameRejected()
+{
+       *this << EndOfGameRejected;
+       device()->flush();
+}
+
+void MsgCoder::sendPleaseFinishTheBoard()
+{
+       *this << PleaseFinishTheBoard;
+       device()->flush();
+}
+void MsgCoder::sendFinishBoardMove()
+{
+       *this << FinishBoardMove;
+       device()->flush();
+}
+void MsgCoder::sendBoardsCompleted()
+{
+       *this << BoardsCompleted;
+       device()->flush();
+}
+
+void MsgCoder::sendWinnerInformation()
+{
+       *this << WinnerInformation;
+       device()->flush();
+}
+void MsgCoder::sendAnotherGameRequest()
+{
+       *this << AnotherGameRequest;
+       device()->flush();
+}
+void MsgCoder::sendAnotherGameAccept()
+{
+       *this << AnotherGameAccept;
+       device()->flush();
+}
+
Index: camino/src/common/MsgCoder.h
diff -u camino/src/common/MsgCoder.h:1.8 camino/src/common/MsgCoder.h:1.9
--- camino/src/common/MsgCoder.h:1.8    Mon Feb 17 19:11:50 2003
+++ camino/src/common/MsgCoder.h        Tue Feb 18 13:43:20 2003
@@ -3,7 +3,7 @@
 ** Camino
 **
 **
-** Version : $Id: MsgCoder.h,v 1.8 2003/02/18 00:11:50 pfremy Exp $
+** Version : $Id: MsgCoder.h,v 1.9 2003/02/18 18:43:20 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -108,8 +108,36 @@
 
        void connectServer( QString playerName );
        void sendMsg( NetMsgSubtype msgLevel, const QString & source, const 
QString & msg );
-       void sendUndo();
        void sendTile( Tile::TileType tile );
+       void sendTilesForYou( Tile::TileType tile );
+
+       void sendServerInformation();
+       void sendPlayerConnected();
+       void sendTeamIsBeingChosen();
+       void sendTeamsComposition();
+       void sendTilesForYou();
+       void sendActivePlayer();
+       void sendPlayerPlaysAMove();
+       void sendMoveRejected();
+       void sendUpdateBoard();
+
+       void sendUndoRequest();
+       void sendUndoAccepted();
+       void sendUndoRejected();
+       void sendUndoUpdateBoard();
+
+       void sendEndOfGameRequest();
+       void sendEndOfGameAccepted();
+       void sendEndOfGameRejected();
+
+       void sendPleaseFinishTheBoard();
+       void sendFinishBoardMove();
+       void sendBoardsCompleted();
+
+       void sendWinnerInformation();
+       void sendAnotherGameRequest();
+       void sendAnotherGameAccept();
+
 
 private:
        MsgCoder( MsgCoder & );
Index: camino/src/common/MsgDecoder.cpp
diff -u camino/src/common/MsgDecoder.cpp:1.7 
camino/src/common/MsgDecoder.cpp:1.8
--- camino/src/common/MsgDecoder.cpp:1.7        Mon Feb 17 19:11:50 2003
+++ camino/src/common/MsgDecoder.cpp    Tue Feb 18 13:43:20 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: MsgDecoder.cpp,v 1.7 2003/02/18 00:11:50 pfremy Exp $
+** Version : $Id: MsgDecoder.cpp,v 1.8 2003/02/18 18:43:20 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
@@ -69,11 +69,11 @@
                                break;
 
                case UndoRequest:
-                               decodeUndo();
+                               decodeUndoRequest();
                                break;
 
                case TilesForYou:
-                               decodeRecvTile();
+                               decodeTilesForYou();
                                break;
 
                case ServerInformation:
@@ -109,17 +109,18 @@
     recvServerConnect( playerName );
 }
 
-void MsgDecoder::decodeUndo()
+void MsgDecoder::decodeUndoRequest()
 {
  //   qDebug( "MsgDecoder::decodeUndo()");
-    recvUndo();
+    recvUndoRequest();
 }
 
-void MsgDecoder::recvUndo()
+void MsgDecoder::recvUndoRequest()
 {
    qDebug( "MsgDecoder::recvUndo()");
 }
 
+
 void MsgDecoder::decodeMsg()
 {
 //    qDebug( "MsgDecoder::decodeMsg()");
@@ -128,15 +129,222 @@
     recvMsg( source , msg );
 }
 
-void MsgDecoder::decodeRecvTile()
+void MsgDecoder::decodeTilesForYou()
 {
        int tt;
     _ts >> tt;
-    recvTile(  ( Tile::TileType ) tt );
+    recvTilesForYou(  ( Tile::TileType ) tt );
+}
+
+
+void MsgDecoder::recvTilesForYou( Tile::TileType /* tile */ )
+{
+       qDebug( "MsgDecoder::recvTilesForYou" );
+}
+
+void MsgDecoder::recvServerInformation()
+{
+       qDebug( "MsgDecoder::recvServerInformation()" );
+}
+
+void MsgDecoder::decodeServerInformation()
+{
+       recvServerInformation();
+}
+
+void MsgDecoder::recvPlayerConnected()
+{
+       qDebug( "MsgDecoder::recvPlayerConnected()" );
+}
+
+void MsgDecoder::decodePlayerConnected()
+{
+       recvPlayerConnected();
+}
+
+void MsgDecoder::recvTeamIsBeingChosen()
+{
+       qDebug( "MsgDecoder::recvTeamIsBeingChosen()" );
+}
+
+void MsgDecoder::decodeTeamIsBeingChosen()
+{
+       recvTeamIsBeingChosen();
+}
+
+void MsgDecoder::recvTeamsComposition()
+{
+       qDebug( "MsgDecoder::recvTeamsComposition()" );
+}
+
+void MsgDecoder::decodeTeamsComposition()
+{
+       recvTeamsComposition();
+}
+
+
+void MsgDecoder::recvActivePlayer()
+{
+       qDebug( "MsgDecoder::recvActivePlayer()" );
+}
+
+void MsgDecoder::decodeActivePlayer()
+{
+       recvActivePlayer();
+}
+
+void MsgDecoder::recvPlayerPlaysAMove()
+{
+       qDebug( "MsgDecoder::recvPlayerPlaysAMove()" );
+}
+
+void MsgDecoder::decodePlayerPlaysAMove()
+{
+       recvPlayerPlaysAMove();
+}
+
+void MsgDecoder::recvMoveRejected()
+{
+       qDebug( "MsgDecoder::recvMoveRejected()" );
+}
+
+void MsgDecoder::decodeMoveRejected()
+{
+       recvMoveRejected();
+}
+
+void MsgDecoder::recvUpdateBoard()
+{
+       qDebug( "MsgDecoder::recvUpdateBoard()" );
+}
+
+void MsgDecoder::decodeUpdateBoard()
+{
+       recvUpdateBoard();
+}
+
+
+void MsgDecoder::recvUndoAccepted()
+{
+       qDebug( "MsgDecoder::recvUndoAccepted()" );
+}
+
+void MsgDecoder::decodeUndoAccepted()
+{
+       recvUndoAccepted();
+}
+
+void MsgDecoder::recvUndoRejected()
+{
+       qDebug( "MsgDecoder::recvUndoRejected()" );
 }
 
+void MsgDecoder::decodeUndoRejected()
+{
+       recvUndoRejected();
+}
+
+void MsgDecoder::recvUndoUpdateBoard()
+{
+       qDebug( "MsgDecoder::recvUndoUpdateBoard()" );
+}
+
+void MsgDecoder::decodeUndoUpdateBoard()
+{
+       recvUndoUpdateBoard();
+}
+
+
+void MsgDecoder::recvEndOfGameRequest()
+{
+       qDebug( "MsgDecoder::recvEndOfGameRequest()" );
+}
+
+void MsgDecoder::decodeEndOfGameRequest()
+{
+       recvEndOfGameRequest();
+}
+
+void MsgDecoder::recvEndOfGameAccepted()
+{
+       qDebug( "MsgDecoder::recvEndOfGameAccepted()" );
+}
+
+void MsgDecoder::decodeEndOfGameAccepted()
+{
+       recvEndOfGameAccepted();
+}
+
+void MsgDecoder::recvEndOfGameRejected()
+{
+       qDebug( "MsgDecoder::recvEndOfGameRejected()" );
+}
+
+void MsgDecoder::decodeEndOfGameRejected()
+{
+       recvEndOfGameRejected();
+}
+
+
+void MsgDecoder::recvPleaseFinishTheBoard()
+{
+       qDebug( "MsgDecoder::recvPleaseFinishTheBoard()" );
+}
+
+void MsgDecoder::decodePleaseFinishTheBoard()
+{
+       recvPleaseFinishTheBoard();
+}
+
+void MsgDecoder::recvFinishBoardMove()
+{
+       qDebug( "MsgDecoder::recvFinishBoardMove()" );
+}
+
+void MsgDecoder::decodeFinishBoardMove()
+{
+       recvFinishBoardMove();
+}
+
+void MsgDecoder::recvBoardsCompleted()
+{
+       qDebug( "MsgDecoder::recvBoardsCompleted()" );
+}
+
+void MsgDecoder::decodeBoardsCompleted()
+{
+       recvBoardsCompleted();
+}
+
+
+void MsgDecoder::recvWinnerInformation()
+{
+       qDebug( "MsgDecoder::recvWinnerInformation()" );
+}
+
+void MsgDecoder::decodeWinnerInformation()
+{
+       recvWinnerInformation();
+}
+
+void MsgDecoder::recvAnotherGameRequest()
+{
+       qDebug( "MsgDecoder::recvAnotherGameRequest()" );
+}
 
-void MsgDecoder::recvTile( Tile::TileType /* tile */ )
+void MsgDecoder::decodeAnotherGameRequest()
 {
-       qDebug( "MsgDecoder::decodeRecvTile" );
+       recvAnotherGameRequest();
 }
+
+void MsgDecoder::recvAnotherGameAccept()
+{
+       qDebug( "MsgDecoder::recvAnotherGameAccept()" );
+}
+
+void MsgDecoder::decodeAnotherGameAccept()
+{
+       recvAnotherGameAccept();
+}
+
+
Index: camino/src/common/MsgDecoder.h
diff -u camino/src/common/MsgDecoder.h:1.9 camino/src/common/MsgDecoder.h:1.10
--- camino/src/common/MsgDecoder.h:1.9  Mon Feb 17 19:11:50 2003
+++ camino/src/common/MsgDecoder.h      Tue Feb 18 13:43:20 2003
@@ -5,7 +5,7 @@
 ** MsgDecoder.h
 ** Decoder for socket msg
 **
-** Version : $Id: MsgDecoder.h,v 1.9 2003/02/18 00:11:50 pfremy Exp $
+** Version : $Id: MsgDecoder.h,v 1.10 2003/02/18 18:43:20 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -58,8 +58,34 @@
        
        virtual void recvServerConnect( QString /* playerName */ ) {}
        virtual void recvMsg( QString /* source */ , QString /* msg */ ) {}
-       virtual void recvTile( Tile::TileType /* tile */ );
-       virtual void recvUndo();
+
+       virtual void recvServerInformation();
+       virtual void recvPlayerConnected();
+       virtual void recvTeamIsBeingChosen();
+       virtual void recvTeamsComposition();
+
+       virtual void recvTilesForYou( Tile::TileType /* tile */ );
+       virtual void recvActivePlayer();
+       virtual void recvPlayerPlaysAMove();
+       virtual void recvMoveRejected();
+       virtual void recvUpdateBoard();
+
+       virtual void recvUndoRequest();
+       virtual void recvUndoAccepted();
+       virtual void recvUndoRejected();
+       virtual void recvUndoUpdateBoard();
+
+       virtual void recvEndOfGameRequest();
+       virtual void recvEndOfGameAccepted();
+       virtual void recvEndOfGameRejected();
+
+       virtual void recvPleaseFinishTheBoard();
+       virtual void recvFinishBoardMove();
+       virtual void recvBoardsCompleted();
+
+       virtual void recvWinnerInformation();
+       virtual void recvAnotherGameRequest();
+       virtual void recvAnotherGameAccept();
 
 public slots:
        /** call this to tell the Decoder that there is some data to decode
@@ -81,7 +107,34 @@
        void decodeServerConnect();
        void decodeMsg();
        void decodeUndo();
-       void decodeRecvTile();
+
+       void decodeServerInformation();
+       void decodePlayerConnected();
+       void decodeTeamIsBeingChosen();
+       void decodeTeamsComposition();
+
+       void decodeTilesForYou();
+       void decodeActivePlayer();
+       void decodePlayerPlaysAMove();
+       void decodeMoveRejected();
+       void decodeUpdateBoard();
+
+       void decodeUndoRequest();
+       void decodeUndoAccepted();
+       void decodeUndoRejected();
+       void decodeUndoUpdateBoard();
+
+       void decodeEndOfGameRequest();
+       void decodeEndOfGameAccepted();
+       void decodeEndOfGameRejected();
+
+       void decodePleaseFinishTheBoard();
+       void decodeFinishBoardMove();
+       void decodeBoardsCompleted();
+
+       void decodeWinnerInformation();
+       void decodeAnotherGameRequest();
+       void decodeAnotherGameAccept();
 
        QIODevice * _socket;
        QDataStream _ts;
Index: camino/src/common/PhilTestRunner.cpp
diff -u camino/src/common/PhilTestRunner.cpp:1.2 
camino/src/common/PhilTestRunner.cpp:1.3
--- camino/src/common/PhilTestRunner.cpp:1.2    Tue Jan 21 17:11:23 2003
+++ camino/src/common/PhilTestRunner.cpp        Tue Feb 18 13:43:20 2003
@@ -49,11 +49,11 @@
        std::string s = test->toString();
        std::string tc_s = "TestCaller ";
        
-       if (s.find( tc_s ) >= 0 ) {
+       if (s.find( tc_s ) != -1 ) {
                s.erase( s.find( tc_s), s.find( tc_s ) + tc_s.size() );
        }
 
-       if (s.find(".") >= 0) {
+       if (s.find(".") != -1 ) {
                std::string suiteName;
                std::string testName;
 
Index: camino/src/server/Player.cpp
diff -u camino/src/server/Player.cpp:1.7 camino/src/server/Player.cpp:1.8
--- camino/src/server/Player.cpp:1.7    Mon Feb 17 17:03:41 2003
+++ camino/src/server/Player.cpp        Tue Feb 18 13:43:20 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: Player.cpp,v 1.7 2003/02/17 22:03:41 pfremy Exp $
+** Version : $Id: Player.cpp,v 1.8 2003/02/18 18:43:20 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
@@ -47,8 +47,8 @@
     // notify server which socket is speaking
     MsgDecoder::slotDecode();
 
-       //qDebug( "bytes available : %ld", _socket->bytesAvailable() );
-       if ( _socket->bytesAvailable() ) { 
+       qDebug( "bytes available : %ld", _socket->bytesAvailable() );
+       while( _socket->bytesAvailable() ) { 
                MsgDecoder::slotDecode();
        }
 }
Index: camino/src/server/TestCaminoServer.h
diff -u camino/src/server/TestCaminoServer.h:1.1 
camino/src/server/TestCaminoServer.h:1.2
--- camino/src/server/TestCaminoServer.h:1.1    Tue Jan 28 16:53:12 2003
+++ camino/src/server/TestCaminoServer.h        Tue Feb 18 13:43:20 2003
@@ -5,7 +5,7 @@
 ** TestCaminoServer.h
 ** Tests the camino server methods.
 **
-** Version : $Id: TestCaminoServer.h,v 1.1 2003/01/28 21:53:12 pfremy Exp $
+** Version : $Id: TestCaminoServer.h,v 1.2 2003/02/18 18:43:20 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
 **
@@ -29,7 +29,7 @@
 #define TEST_CAMINO_SERVER_H
 
 #include "cppunit/TestCase.h"
-#include "cppunit/extensions/helpermacros.h"
+#include "cppunit/extensions/HelperMacros.h"
 
 class TestCaminoServer  : public CppUnit::TestCase 
 {




reply via email to

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