camino-devel
[Top][All Lists]
Advanced

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

[Camino-devel] camino/src main.cpp client/ClientInterface.cpp ...


From: Philippe Fremy
Subject: [Camino-devel] camino/src main.cpp client/ClientInterface.cpp ...
Date: Fri, 28 Feb 2003 07:52:56 -0500

CVSROOT:        /cvsroot/camino
Module name:    camino
Changes by:     Philippe Fremy <address@hidden> 03/02/28 07:52:55

Modified files:
        src            : main.cpp 
        src/client     : ClientInterface.cpp 
        src/server     : CaminoServer.cpp CaminoServer.h Player.cpp 

Log message:
        - enable autostart of server in command line mode

Patches:
Index: camino/src/client/ClientInterface.cpp
diff -u camino/src/client/ClientInterface.cpp:1.22 
camino/src/client/ClientInterface.cpp:1.23
--- camino/src/client/ClientInterface.cpp:1.22  Thu Feb 27 05:21:22 2003
+++ camino/src/client/ClientInterface.cpp       Fri Feb 28 07:52:54 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: ClientInterface.cpp,v 1.22 2003/02/27 10:21:22 pfremy Exp $
+** Version : $Id: ClientInterface.cpp,v 1.23 2003/02/28 12:52:54 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
@@ -51,7 +51,6 @@
 ClientInterface::ClientInterface( bool connectImmediately, 
                        QString host, int port, QString player )
 {
-       //_clientEngine = new ClientEngine();
        _serverDialog = 0;
        _server = 0;
        _serverWidget = 0;
Index: camino/src/main.cpp
diff -u camino/src/main.cpp:1.5 camino/src/main.cpp:1.6
--- camino/src/main.cpp:1.5     Mon Feb 17 17:03:41 2003
+++ camino/src/main.cpp Fri Feb 28 07:52:54 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: main.cpp,v 1.5 2003/02/17 22:03:41 pfremy Exp $
+** Version : $Id: main.cpp,v 1.6 2003/02/28 12:52:54 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
@@ -42,24 +42,24 @@
        QString hostName = "localhost";
        QString playerName = "Phil";
        int port = 6789;
-       bool clientArgPassed = false;
+       bool clientConnectsImmediately = false;
        bool startServer = false;
 
        for( int i=1; i<argc; i++ ) {
            if ( QString( argv[i] ) == "--host" && i+1 < argc ) {
-               clientArgPassed = true;
+               clientConnectsImmediately = true;
                ++i;
                continue;
            }
            if ( QString( argv[i] ) == "--port" && i+1 < argc ) {
                port = QString( argv[ i + 1 ] ).toInt();
-               clientArgPassed = true;
+               clientConnectsImmediately = true;
                ++i;
                continue;
            }
            if ( QString( argv[i] ) == "--player" && i+1 < argc ) {
                playerName = argv[ i + 1 ];
-               clientArgPassed = true;
+               clientConnectsImmediately = true;
                ++i;
                continue;
            }
@@ -67,18 +67,20 @@
                startServer = true;
                continue;
            }
+               qDebug("non recognised option %s", argv[i] );
        }
        
 
-       if ( startServer ) clientArgPassed = false;
-       ClientInterface clientWindow(  clientArgPassed, hostName, port, 
playerName );
+       if ( startServer ) clientConnectsImmediately = false;
+       ClientInterface clientWindow(  clientConnectsImmediately, 
+                                                               hostName, port, 
playerName );
        //clientWindow.showMaximized();
        app.setMainWidget( &clientWindow );
        clientWindow.show();
 
        if ( startServer == true ) {
                clientWindow.hide();
-           CaminoServer * server = new CaminoServer( port, 2 );
+           CaminoServer * server = new CaminoServer( port, 2, true );
                if ( ! server->ok() ) {
                        qDebug( "Could not create server, port is probably 
still in use" );
                        return 1;
Index: camino/src/server/CaminoServer.cpp
diff -u camino/src/server/CaminoServer.cpp:1.14 
camino/src/server/CaminoServer.cpp:1.15
--- camino/src/server/CaminoServer.cpp:1.14     Fri Feb 28 07:40:54 2003
+++ camino/src/server/CaminoServer.cpp  Fri Feb 28 07:52:54 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: CaminoServer.cpp,v 1.14 2003/02/28 12:40:54 pfremy Exp $
+** Version : $Id: CaminoServer.cpp,v 1.15 2003/02/28 12:52:54 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 19/01/2003
@@ -35,7 +35,7 @@
 #include "server/Player.h"
 
 
-CaminoServer::CaminoServer( int port, int playerNb )
+CaminoServer::CaminoServer( int port, int playerNb, bool autoStart )
        : QServerSocket( port )
 {
        _tileStack = new TileStack();
@@ -44,6 +44,7 @@
        _state = WaitingForConnection;
        _activePlayer = 0L;
        _teamConfiguration = 0;
+       _autoStart = autoStart;
 }
 
 void CaminoServer::newConnection( int numSocket )
Index: camino/src/server/CaminoServer.h
diff -u camino/src/server/CaminoServer.h:1.11 
camino/src/server/CaminoServer.h:1.12
--- camino/src/server/CaminoServer.h:1.11       Fri Feb 28 07:40:54 2003
+++ camino/src/server/CaminoServer.h    Fri Feb 28 07:52:54 2003
@@ -5,7 +5,7 @@
 ** CaminoServer.h
 ** Server for the game
 **
-** Version : $Id: CaminoServer.h,v 1.11 2003/02/28 12:40:54 pfremy Exp $
+** Version : $Id: CaminoServer.h,v 1.12 2003/02/28 12:52:54 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 19/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -58,7 +58,7 @@
 
 public:
        /** Constructor */
-       CaminoServer( int port, int playerNb );
+       CaminoServer( int port, int playerNb, bool autoStart = false );
 
 
        enum ServerState {
@@ -101,6 +101,7 @@
        int _teamConfiguration;
        ServerState _state;
        Player * _activePlayer;
+       bool _autoStart;
 
 friend class Player;
 #ifdef DEBUG
Index: camino/src/server/Player.cpp
diff -u camino/src/server/Player.cpp:1.11 camino/src/server/Player.cpp:1.12
--- camino/src/server/Player.cpp:1.11   Fri Feb 28 07:40:54 2003
+++ camino/src/server/Player.cpp        Fri Feb 28 07:52:54 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: Player.cpp,v 1.11 2003/02/28 12:40:54 pfremy Exp $
+** Version : $Id: Player.cpp,v 1.12 2003/02/28 12:52:54 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
@@ -73,6 +73,9 @@
                // normally not necessary in two players mode
                emit _server->sig_readyToStart(); 
                _server->_state = CaminoServer::ReadyToStart;
+               if (_server->_autoStart) {
+                       _server->beginParty();
+               }
        }
 }
 




reply via email to

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