camino-devel
[Top][All Lists]
Advanced

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

[Camino-devel] camino/src/server Player.cpp Player.h


From: Philippe Fremy
Subject: [Camino-devel] camino/src/server Player.cpp Player.h
Date: Thu, 27 Feb 2003 16:44:56 -0500

CVSROOT:        /cvsroot/camino
Module name:    camino
Changes by:     Philippe Fremy <address@hidden> 03/02/27 16:44:56

Modified files:
        src/server     : Player.cpp Player.h 

Log message:
        two players can now play alternatively

Patches:
Index: camino/src/server/Player.cpp
diff -u camino/src/server/Player.cpp:1.9 camino/src/server/Player.cpp:1.10
--- camino/src/server/Player.cpp:1.9    Thu Feb 27 05:24:43 2003
+++ camino/src/server/Player.cpp        Thu Feb 27 16:44:56 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: Player.cpp,v 1.9 2003/02/27 10:24:43 pfremy Exp $
+** Version : $Id: Player.cpp,v 1.10 2003/02/27 21:44:56 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
@@ -87,4 +87,21 @@
        _server->broadcastMsg( _subtype, source, msg );
 }
 
+void Player::recvPlayerPlaysAMove( Tile * /* tile */ )
+{
+       QString msg;
+       if (this != _server->_activePlayer) {
+               msg = _playerName + " tried to play but he is not the active 
player!";
+               _server->serverBroadcastMsg( DebugMsg, msg );
+               qDebug("Player::recvPlayerPlaysAMove - %s", msg.latin1() );
+               return;
+       }
 
+       // check that move is valid
+       // remove tile from player set
+       // add tile to the board
+       // update the clients about the new tile
+       // distribute new tile to previous player
+       // activate new player
+       _server->activateNextPlayer();
+}
Index: camino/src/server/Player.h
diff -u camino/src/server/Player.h:1.8 camino/src/server/Player.h:1.9
--- camino/src/server/Player.h:1.8      Thu Feb 27 05:24:43 2003
+++ camino/src/server/Player.h  Thu Feb 27 16:44:56 2003
@@ -5,7 +5,7 @@
 ** Player.h
 ** this is a template for all .h files
 **
-** Version : $Id: Player.h,v 1.8 2003/02/27 10:24:43 pfremy Exp $
+** Version : $Id: Player.h,v 1.9 2003/02/27 21:44:56 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -59,6 +59,8 @@
 
     virtual void recvPlayerInfo( QString playerName );
        virtual void recvMsg( QString source, QString msg );
+    virtual void recvPlayerPlaysAMove( Tile * tile );
+
 
 public slots:
     virtual void slotDecode();




reply via email to

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