Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 8, 2010, 3:05:07 PM (14 years ago)
Author:
smerkli
Message:

changes done, use —masterserver to launch master server

Location:
code/branches/masterserver/src/orxonox/gamestates
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/masterserver/src/orxonox/gamestates/CMakeLists.txt

    r6105 r7730  
    66  GSRoot.cc
    77  GSServer.cc
     8  GSMasterServer.cc
    89  GSStandalone.cc
    910)
  • code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.cc

    r7727 r7730  
    3131
    3232#include "util/Debug.h"
    33 #include "core/CommandLineParser.h"
    3433#include "core/Game.h"
    3534#include "core/GameMode.h"
    36 #include "network/Server.h"
    3735
    3836namespace orxonox
    3937{
    40     DeclareGameState(GSMasterServer, "masterserver", false, false);
     38  DeclareGameState(GSMasterServer, "masterserver", false, false);
    4139
    42     SetCommandLineArgument(port, 55566).shortcut("p").information("Network communication port to be used 0-65535 (default: 55566)");
     40  GSMasterServer::GSMasterServer(const GameStateInfo& info)
     41    : GameState(info)
     42  {
    4343
    44     GSMasterServer::GSMasterServer(const GameStateInfo& info)
    45         : GameState(info)
    46         , server_(0)
    47     {
    48     }
     44  }
    4945
    50     GSMasterServer::~GSMasterServer()
    51     {
    52     }
     46  GSMasterServer::~GSMasterServer()
     47  {
     48    this->mserver->~MasterServer();
     49  }
    5350
    54     void GSMasterServer::activate()
    55     {
    56         GameMode::setIsServer(true);
     51  void GSMasterServer::activate()
     52  {
     53    /* TODO make this work for masterserver as well */
     54    //GameMode::setIsServer(true);
    5755
    58         this->server_ = new Server(CommandLineParser::getValue("port"));
    59         COUT(0) << "Loading scene in server mode" << std::endl;
     56    this->mserver = new MasterServer();
     57    COUT(0) << "Loading masterserver mode" << std::endl;
    6058
    61         server_->open();
    62     }
     59    this->mserver->run();
     60  }
    6361
    64     void GSMasterServer::deactivate()
    65     {
    66         this->server_->close();
    67         delete this->server_;
     62  void GSMasterServer::deactivate()
     63  { /* nothing so far */ }
    6864
    69         GameMode::setIsServer(false);
    70     }
    71 
    72     void GSMasterServer::update(const Clock& time)
    73     {
    74         server_->update(time);
    75     }
     65  void GSMasterServer::update(const Clock& time)
     66  { /* nothing so far */ }
    7667}
  • code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.h

    r7727 r7730  
    3535#include "core/GameState.h"
    3636#include "network/NetworkPrereqs.h"
     37#include "network/MasterServer.h"
    3738
    3839namespace orxonox
    3940{
    40     class _OrxonoxExport GSMasterServer : public GameState
    41     {
     41  class _OrxonoxExport GSMasterServer : public GameState
     42  {
    4243    public:
    43         GSMasterServer(const GameStateInfo& info);
    44         ~GSMasterServer();
     44      GSMasterServer(const GameStateInfo& info);
     45      ~GSMasterServer();
    4546
    46         void activate();
    47         void deactivate();
    48         void update(const Clock& time);
     47      void activate();
     48      void deactivate();
     49      void update(const Clock& time);
    4950
    5051    private:
    51        
    52     };
     52      MasterServer *mserver;
     53
     54
     55  };
    5356}
    5457
Note: See TracChangeset for help on using the changeset viewer.