[Orxonox-commit 3034] r7730 - in code/branches/masterserver/src: libraries/network modules orxonox/gamestates

smerkli at orxonox.net smerkli at orxonox.net
Wed Dec 8 15:05:07 CET 2010


Author: smerkli
Date: 2010-12-08 15:05:07 +0100 (Wed, 08 Dec 2010)
New Revision: 7730

Removed:
   code/branches/masterserver/src/modules/masterserver/
Modified:
   code/branches/masterserver/src/libraries/network/CMakeLists.txt
   code/branches/masterserver/src/libraries/network/MasterServer.h
   code/branches/masterserver/src/orxonox/gamestates/CMakeLists.txt
   code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.cc
   code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.h
Log:
changes done, use --masterserver to launch master server

Modified: code/branches/masterserver/src/libraries/network/CMakeLists.txt
===================================================================
--- code/branches/masterserver/src/libraries/network/CMakeLists.txt	2010-12-08 13:33:54 UTC (rev 7729)
+++ code/branches/masterserver/src/libraries/network/CMakeLists.txt	2010-12-08 14:05:07 UTC (rev 7730)
@@ -36,6 +36,9 @@
   NetworkFunction.cc
   Host.cc
   Server.cc
+  MasterServer.cc
+  PeerList.cc
+  ServerList.cc
   ServerConnection.cc
   TrafficControl.cc
 )
@@ -61,13 +64,15 @@
   NetworkPrecompiledHeaders.h
   NetworkPrereqs.h
   Server.h
+  MasterServer.h
+  PeerList.h
+  ServerList.h
   ServerConnection.h
   TrafficControl.h
 )
 
 ADD_SUBDIRECTORY(packet)
 ADD_SUBDIRECTORY(synchronisable)
-ADD_SUBDIRECTORY(masterserver)
 
 ORXONOX_ADD_LIBRARY(network
   TOLUA_FILES

Modified: code/branches/masterserver/src/libraries/network/MasterServer.h
===================================================================
--- code/branches/masterserver/src/libraries/network/MasterServer.h	2010-12-08 13:33:54 UTC (rev 7729)
+++ code/branches/masterserver/src/libraries/network/MasterServer.h	2010-12-08 14:05:07 UTC (rev 7730)
@@ -55,6 +55,9 @@
       MasterServer();
       ~MasterServer();
 
+      /* main routine */
+      int run();
+
     private:
       /* methods */
       int eventConnect( ENetEvent *event );
@@ -73,8 +76,6 @@
       unsigned int port;
       bool quit;
 
-      /* main routine */
-      int run();
   };
 }
 

Modified: code/branches/masterserver/src/orxonox/gamestates/CMakeLists.txt
===================================================================
--- code/branches/masterserver/src/orxonox/gamestates/CMakeLists.txt	2010-12-08 13:33:54 UTC (rev 7729)
+++ code/branches/masterserver/src/orxonox/gamestates/CMakeLists.txt	2010-12-08 14:05:07 UTC (rev 7730)
@@ -5,5 +5,6 @@
   GSMainMenu.cc
   GSRoot.cc
   GSServer.cc
+  GSMasterServer.cc
   GSStandalone.cc
 )

Modified: code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.cc
===================================================================
--- code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.cc	2010-12-08 13:33:54 UTC (rev 7729)
+++ code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.cc	2010-12-08 14:05:07 UTC (rev 7730)
@@ -30,47 +30,38 @@
 #include "GSMasterServer.h"
 
 #include "util/Debug.h"
-#include "core/CommandLineParser.h"
 #include "core/Game.h"
 #include "core/GameMode.h"
-#include "network/Server.h"
 
 namespace orxonox
 {
-    DeclareGameState(GSMasterServer, "masterserver", false, false);
+  DeclareGameState(GSMasterServer, "masterserver", false, false);
 
-    SetCommandLineArgument(port, 55566).shortcut("p").information("Network communication port to be used 0-65535 (default: 55566)");
+  GSMasterServer::GSMasterServer(const GameStateInfo& info)
+    : GameState(info)
+  {
 
-    GSMasterServer::GSMasterServer(const GameStateInfo& info)
-        : GameState(info)
-        , server_(0)
-    {
-    }
+  }
 
-    GSMasterServer::~GSMasterServer()
-    {
-    }
+  GSMasterServer::~GSMasterServer()
+  {
+    this->mserver->~MasterServer();
+  }
 
-    void GSMasterServer::activate()
-    {
-        GameMode::setIsServer(true);
+  void GSMasterServer::activate()
+  {
+    /* TODO make this work for masterserver as well */
+    //GameMode::setIsServer(true);
 
-        this->server_ = new Server(CommandLineParser::getValue("port"));
-        COUT(0) << "Loading scene in server mode" << std::endl;
+    this->mserver = new MasterServer();
+    COUT(0) << "Loading masterserver mode" << std::endl;
 
-        server_->open();
-    }
+    this->mserver->run();
+  }
 
-    void GSMasterServer::deactivate()
-    {
-        this->server_->close();
-        delete this->server_;
+  void GSMasterServer::deactivate()
+  { /* nothing so far */ }
 
-        GameMode::setIsServer(false);
-    }
-
-    void GSMasterServer::update(const Clock& time)
-    {
-        server_->update(time);
-    }
+  void GSMasterServer::update(const Clock& time)
+  { /* nothing so far */ }
 }

Modified: code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.h
===================================================================
--- code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.h	2010-12-08 13:33:54 UTC (rev 7729)
+++ code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.h	2010-12-08 14:05:07 UTC (rev 7730)
@@ -34,22 +34,25 @@
 
 #include "core/GameState.h"
 #include "network/NetworkPrereqs.h"
+#include "network/MasterServer.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport GSMasterServer : public GameState
-    {
+  class _OrxonoxExport GSMasterServer : public GameState
+  {
     public:
-        GSMasterServer(const GameStateInfo& info);
-        ~GSMasterServer();
+      GSMasterServer(const GameStateInfo& info);
+      ~GSMasterServer();
 
-        void activate();
-        void deactivate();
-        void update(const Clock& time);
+      void activate();
+      void deactivate();
+      void update(const Clock& time);
 
     private:
-        
-    };
+      MasterServer *mserver;
+
+
+  };
 }
 
 #endif /* _GSServer_H__ */




More information about the Orxonox-commit mailing list