Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 28, 2009, 11:47:22 PM (16 years ago)
Author:
adrfried
Message:

some more work on ggzclient

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ggz/src/orxonox/gamestates/GSClient.cc

    r3106 r3107  
    3030#include "OrxonoxStableHeaders.h"
    3131#include "GSClient.h"
     32#include "SpecialConfig.h"
    3233
    3334#include "core/input/InputManager.h"
     
    4445
    4546    GSClient::GSClient()
    46         : GameState<GSGraphics>("client")
    47         , client_(0)
     47        : GameState<GSGraphics>("client"),
     48        client_(0),
     49        ggzClient(0)
    4850    {
    4951    }
     
    5860
    5961#ifdef GGZMOD_FOUND
    60         ggzClient = NULL;
    61         if (GGZClient::isActive()) {
    62             COUT(3) << "Initializing GGZ\n";
    63             ggzClient = new GGZClient;
     62        if (GGZClient::isActive())
     63        {
     64            this->ggzClient = new GGZClient(this);
     65            return;
    6466        }
    65         else {
    66             COUT(3) << "Not using GGZ\n";
    67         }
    68 #else  /* GGZMOD_FOUND */
    69         COUT(3) << "GGZ support disabled\n";
    7067#endif /* GGZMOD_FOUND */
    7168
    72         this->client_ = new Client(CommandLine::getValue("ip").getString(), CommandLine::getValue("port"));
     69        this->connect(CommandLine::getValue("ip").getString(), CommandLine::getValue("port"));
     70    }
     71
     72    void GSClient::connect(const std::string& address, int port)
     73    {
     74        this->client_ = new Client(address, port);
    7375
    7476        if(!client_->establishConnection())
     
    8688        client_->closeConnection();
    8789
    88 #ifdef GGZMOD_FOUND
    8990        if (ggzClient)
    9091        {
    9192            delete ggzClient;
    9293        }
    93 #endif /* GGZMOD_FOUND */
    9494
    9595        // destroy client
Note: See TracChangeset for help on using the changeset viewer.