camino-devel
[Top][All Lists]
Advanced

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

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


From: Philippe Fremy
Subject: [Camino-devel] camino/src/server CaminoServer.h CaminoServer.cpp
Date: Thu, 27 Feb 2003 14:34:40 -0500

CVSROOT:        /cvsroot/camino
Module name:    camino
Changes by:     Philippe Fremy <address@hidden> 03/02/27 14:34:40

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

Log message:
        server activates properly the next player

Patches:
Index: camino/src/server/CaminoServer.cpp
diff -u camino/src/server/CaminoServer.cpp:1.12 
camino/src/server/CaminoServer.cpp:1.13
--- camino/src/server/CaminoServer.cpp:1.12     Thu Feb 27 12:26:25 2003
+++ camino/src/server/CaminoServer.cpp  Thu Feb 27 14:34:39 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: CaminoServer.cpp,v 1.12 2003/02/27 17:26:25 pfremy Exp $
+** Version : $Id: CaminoServer.cpp,v 1.13 2003/02/27 19:34:39 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 19/01/2003
@@ -104,13 +104,29 @@
        _tileStack->init();
 
        distributeTiles();
-       // check that every player can play with its tiles
-       sendDistributedTiles();
-       // activate current player
-       _activePlayer = _playerList.first();
+       activateNextPlayer();
+       
        _state = PlayGame;
 }
 
+void CaminoServer::activateNextPlayer()
+{
+       if (_activePlayer == 0L || _activePlayer == _playerList.getLast()) {
+               _activePlayer = _playerList.first();
+       } else {
+               int idx;
+               idx = _playerList.find( _activePlayer );
+               Q_ASSERT( idx != -1 );
+               _activePlayer = _playerList.next();
+       }
+
+       QPtrListIterator<Player> it( _playerList );
+       while(  it.current() ) {
+               it.current()->sendActivePlayer( _activePlayer->getPlayerName() 
);
+               ++it;
+       }
+}
+
 void CaminoServer::distributeTiles()
 {
        qDebug( "CaminoServer::distributeTiles() " );
@@ -127,6 +143,8 @@
                        ++it;
                }
        }
+       // check that every player can play with its tiles
+       sendDistributedTiles();
 }
 
 void CaminoServer::sendDistributedTiles()
Index: camino/src/server/CaminoServer.h
diff -u camino/src/server/CaminoServer.h:1.9 
camino/src/server/CaminoServer.h:1.10
--- camino/src/server/CaminoServer.h:1.9        Tue Feb 18 18:15:44 2003
+++ camino/src/server/CaminoServer.h    Thu Feb 27 14:34:39 2003
@@ -5,7 +5,7 @@
 ** CaminoServer.h
 ** Server for the game
 **
-** Version : $Id: CaminoServer.h,v 1.9 2003/02/18 23:15:44 pfremy Exp $
+** Version : $Id: CaminoServer.h,v 1.10 2003/02/27 19:34:39 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 19/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -83,6 +83,7 @@
 
        void distributeTiles();
        void sendDistributedTiles();
+       void activateNextPlayer();
 
 signals:
        void sig_newConnection( QSocket * );




reply via email to

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