[Top][All Lists]
[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 11:46:18 -0500 |
CVSROOT: /cvsroot/camino
Module name: camino
Changes by: Philippe Fremy <address@hidden> 03/03/02 11:46:07
Modified files:
src/client : Game.cpp Game.h TilePresentation.cpp
src/common : MsgCoder.cpp MsgCoder.h MsgDecoder.cpp
MsgDecoder.h
Log message:
tiles are now removed from the player list on the client
Patches:
Index: camino/src/client/Game.cpp
diff -u camino/src/client/Game.cpp:1.24 camino/src/client/Game.cpp:1.25
--- camino/src/client/Game.cpp:1.24 Sun Mar 2 11:31:28 2003
+++ camino/src/client/Game.cpp Sun Mar 2 11:46:02 2003
@@ -2,7 +2,7 @@
**
** Camino
**
-** Version : $Id: Game.cpp,v 1.24 2003/03/02 16:31:28 pfremy Exp $
+** Version : $Id: Game.cpp,v 1.25 2003/03/02 16:46:02 pfremy Exp $
**
** Author(s) : Philippe Fremy, Pascal Audoux
** Creation : 15/01/2003
@@ -66,7 +66,7 @@
slot_clientConnected( false ); // sets the text of the player label
QHBox * hbox = new QHBox( vbox );
- _presentation = new TilePresentation( hbox );
+ _tilePresentation = new TilePresentation( hbox );
BoardView * boardView = new BoardView( _board, hbox );
_actions = new ActionList( hbox );
_chat = new ChatWidget( vbox );
@@ -95,7 +95,7 @@
{
//_actions->reupdate();
//_board->reupdate();
- _presentation->reupdate();
+ _tilePresentation->reupdate();
}
void Game::connectToServer( QString host, int port, QString player )
@@ -221,7 +221,7 @@
void Game::recvTilesForYou( Tile::TileType tile )
{
// qDebug( "Game::recvTile - %d", ( int )tile );
- _presentation->addTile( new Tile( tile ) );
+ _tilePresentation->addTile( new Tile( tile ) );
}
void Game::slot_undo()
@@ -243,9 +243,8 @@
void Game::slot_tileClickedInBoard( int row, int col )
{
- qDebug("Game::tileClickedInBoard - %dx%d", row, col );
// check if we have one tile selected in tile presentation
- if (_presentation->getSelected() == 0L) {
+ if (_tilePresentation->getSelected() == 0L) {
return;
}
@@ -257,12 +256,9 @@
// 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
- // if all the check pass, send the tile to the server
- qDebug("Game::tileClickedInBoard - sending to server" );
- sendPlayerPlaysAMove( _presentation->getSelected() );
+ sendPlayerPlaysAMove( _tilePresentation->getSelected() );
- // if the server accepts the move, he will send us a message to add the
- // tile to the board.
+ _tilePresentation->removeSelectedTile();
}
void Game::recvUpdateBoard( Tile * tile, bool removeIt )
Index: camino/src/client/Game.h
diff -u camino/src/client/Game.h:1.17 camino/src/client/Game.h:1.18
--- camino/src/client/Game.h:1.17 Sun Mar 2 11:31:28 2003
+++ camino/src/client/Game.h Sun Mar 2 11:46:02 2003
@@ -5,7 +5,7 @@
** Game.h
** Main widget of the game
**
-** Version : $Id: Game.h,v 1.17 2003/03/02 16:31:28 pfremy Exp $
+** Version : $Id: Game.h,v 1.18 2003/03/02 16:46:02 pfremy Exp $
** Author(s) : Philippe Fremy, Pascal Audoux
** Creation : 15/01/2003
** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -98,7 +98,7 @@
protected:
ActionList * _actions;
- TilePresentation * _presentation;
+ TilePresentation * _tilePresentation;
BoardCanvas * _board;
ChatWidget * _chat;
QLabel * _playerLabel;
Index: camino/src/client/TilePresentation.cpp
diff -u camino/src/client/TilePresentation.cpp:1.8
camino/src/client/TilePresentation.cpp:1.9
--- camino/src/client/TilePresentation.cpp:1.8 Thu Feb 27 12:54:22 2003
+++ camino/src/client/TilePresentation.cpp Sun Mar 2 11:46:02 2003
@@ -2,7 +2,7 @@
**
** Camino
**
-** Version : $Id: TilePresentation.cpp,v 1.8 2003/02/27 17:54:22 pfremy Exp $
+** Version : $Id: TilePresentation.cpp,v 1.9 2003/03/02 16:46:02 pfremy Exp $
**
** Author(s) : Philippe Fremy, Pascal Audoux
** Creation : 28/01/2003
@@ -104,6 +104,9 @@
for( ; it.current(); ++it ) {
if (it.current()->getTile() == tile ) {
it.current()->setTile( 0L );
+ if (_selectedTileButton->getTile() == tile) {
+ _selectedTileButton->setTile( 0L );
+ }
return;
}
}
@@ -113,6 +116,7 @@
void TilePresentation::removeSelectedTile()
{
removeTile( _selectedTileButton->getTile() );
+ _selectedTileButton->setTile( 0L );
}
Tile * TilePresentation::getSelected()
Index: camino/src/common/MsgCoder.cpp
diff -u camino/src/common/MsgCoder.cpp:1.13 camino/src/common/MsgCoder.cpp:1.14
--- camino/src/common/MsgCoder.cpp:1.13 Thu Feb 27 13:21:44 2003
+++ camino/src/common/MsgCoder.cpp Sun Mar 2 11:46:04 2003
@@ -2,7 +2,7 @@
**
** Camino
**
-** Version : $Id: MsgCoder.cpp,v 1.13 2003/02/27 18:21:44 pfremy Exp $
+** Version : $Id: MsgCoder.cpp,v 1.14 2003/03/02 16:46:04 pfremy Exp $
**
** Author(s) : Philippe Fremy, Pascal Audoux
** Creation : 14/01/2003
@@ -102,9 +102,10 @@
device()->flush();
}
-void MsgCoder::sendMoveRejected()
+void MsgCoder::sendMoveRejected( Tile * tile )
{
*this << MoveRejected << 0;
+ sendTile( tile );
device()->flush();
}
void MsgCoder::sendUpdateBoard( Tile * tile, bool removeTile )
Index: camino/src/common/MsgCoder.h
diff -u camino/src/common/MsgCoder.h:1.13 camino/src/common/MsgCoder.h:1.14
--- camino/src/common/MsgCoder.h:1.13 Thu Feb 27 13:21:44 2003
+++ camino/src/common/MsgCoder.h Sun Mar 2 11:46:04 2003
@@ -3,7 +3,7 @@
** Camino
**
**
-** Version : $Id: MsgCoder.h,v 1.13 2003/02/27 18:21:44 pfremy Exp $
+** Version : $Id: MsgCoder.h,v 1.14 2003/03/02 16:46:04 pfremy Exp $
** Author(s) : Philippe Fremy, Pascal Audoux
** Creation : 14/01/2003
** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -116,7 +116,7 @@
void sendTeamsComposition();
void sendActivePlayer( QString playerName );
void sendPlayerPlaysAMove( Tile * tile );
- void sendMoveRejected();
+ void sendMoveRejected( Tile * tile );
void sendUpdateBoard( Tile * tile, bool removeTile = false);
void sendUndoRequest();
Index: camino/src/common/MsgDecoder.cpp
diff -u camino/src/common/MsgDecoder.cpp:1.11
camino/src/common/MsgDecoder.cpp:1.12
--- camino/src/common/MsgDecoder.cpp:1.11 Thu Feb 27 13:21:44 2003
+++ camino/src/common/MsgDecoder.cpp Sun Mar 2 11:46:05 2003
@@ -2,7 +2,7 @@
**
** Camino
**
-** Version : $Id: MsgDecoder.cpp,v 1.11 2003/02/27 18:21:44 pfremy Exp $
+** Version : $Id: MsgDecoder.cpp,v 1.12 2003/03/02 16:46:05 pfremy Exp $
**
** Author(s) : Philippe Fremy, Pascal Audoux
** Creation : 15/01/2003
@@ -261,14 +261,14 @@
return tile;
}
-void MsgDecoder::recvMoveRejected()
+void MsgDecoder::recvMoveRejected( Tile * )
{
qDebug( "MsgDecoder::recvMoveRejected()" );
}
void MsgDecoder::decodeMoveRejected()
{
- recvMoveRejected();
+ recvMoveRejected( decodeTile() );
}
void MsgDecoder::recvUpdateBoard( Tile * tile, bool removeTile )
Index: camino/src/common/MsgDecoder.h
diff -u camino/src/common/MsgDecoder.h:1.13 camino/src/common/MsgDecoder.h:1.14
--- camino/src/common/MsgDecoder.h:1.13 Thu Feb 27 13:21:44 2003
+++ camino/src/common/MsgDecoder.h Sun Mar 2 11:46:05 2003
@@ -5,7 +5,7 @@
** MsgDecoder.h
** Decoder for socket msg
**
-** Version : $Id: MsgDecoder.h,v 1.13 2003/02/27 18:21:44 pfremy Exp $
+** Version : $Id: MsgDecoder.h,v 1.14 2003/03/02 16:46:05 pfremy Exp $
** Author(s) : Philippe Fremy, Pascal Audoux
** Creation : 14/01/2003
** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -65,7 +65,7 @@
virtual void recvTilesForYou( Tile::TileType /* tile */ );
virtual void recvActivePlayer( QString playerName );
virtual void recvPlayerPlaysAMove( Tile * tile );
- virtual void recvMoveRejected();
+ virtual void recvMoveRejected( Tile * tile );
virtual void recvUpdateBoard( Tile * tile, bool removeTile );
virtual void recvUndoRequest();
- [Camino-devel] camino/src client/Game.cpp client/Game.h client...,
Philippe Fremy <=