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: Sat, 08 Mar 2003 08:47:28 -0500

CVSROOT:        /cvsroot/camino
Module name:    camino
Changes by:     Pascal Audoux <address@hidden>  03/03/08 08:47:27

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

Log message:
        play tile only if the button 'play' is selected

Patches:
Index: camino/src/client/Game.cpp
diff -u camino/src/client/Game.cpp:1.29 camino/src/client/Game.cpp:1.30
--- camino/src/client/Game.cpp:1.29     Tue Mar  4 16:29:35 2003
+++ camino/src/client/Game.cpp  Sat Mar  8 08:47:26 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: Game.cpp,v 1.29 2003/03/04 21:29:35 Audoux Exp $
+** Version : $Id: Game.cpp,v 1.30 2003/03/08 13:47:26 Audoux Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
@@ -44,6 +44,7 @@
   : QWidget( parent, name, QWidget::WStyle_Customize | 
QWidget::WStyle_DialogBorder )
 {
        _playerActive = false;
+       _stateAction  = ActionNone;
 
        _socket = new QSocket( this );
        _state = StateNotConnected;
@@ -129,16 +130,17 @@
 void Game::slot_play()
 {
        // play something
+       _stateAction = ActionPlay;
 }
 
 void Game::slot_complete()
 {
-
+       _stateAction = ActionComplete;
 }
 
 void Game::slot_trash()
 {
-
+       _stateAction = ActionTrash;
 }
 
 void Game::slot_clientConnected( bool state )
@@ -197,6 +199,7 @@
 
 void Game::slot_undo()
 {
+       _stateAction = ActionNone;
        sendUndo();
 }
 
@@ -217,8 +220,8 @@
        // check if the rule allow to play here: ask board to do that
 
        _tilePresentation->getSelected()->setPosition( row, col );
-       sendPlayerPlaysAMove( _tilePresentation->getSelected() );
-
-
-       _tilePresentation->removeSelectedTile();
+       if( _stateAction == ActionPlay ) {
+               sendPlayerPlaysAMove( _tilePresentation->getSelected() );
+               _tilePresentation->removeSelectedTile();
+       }
 }
Index: camino/src/client/Game.h
diff -u camino/src/client/Game.h:1.21 camino/src/client/Game.h:1.22
--- camino/src/client/Game.h:1.21       Tue Mar  4 16:39:39 2003
+++ camino/src/client/Game.h    Sat Mar  8 08:47:26 2003
@@ -5,7 +5,7 @@
 ** Game.h
 ** Main widget of the game
 **
-** Version : $Id: Game.h,v 1.21 2003/03/04 21:39:39 Audoux Exp $
+** Version : $Id: Game.h,v 1.22 2003/03/08 13:47:26 Audoux Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -137,6 +137,13 @@
                StateUndoProcessing,
                StatePlay
        } _state;
+
+       enum StateAction {
+               ActionNone,
+               ActionPlay,
+               ActionComplete,
+               ActionTrash
+       } _stateAction;
 
        QSocket * _socket;
        QString _playerName;




reply via email to

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