Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

some more work on ggzclient

Location:
code/branches/ggz/src/orxonox/gamestates
Files:
2 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
  • code/branches/ggz/src/orxonox/gamestates/GSClient.h

    r3106 r3107  
    3030#define _GSClient_H__
    3131
    32 #include "SpecialConfig.h"
    3332#include "OrxonoxPrereqs.h"
    3433#include "network/NetworkPrereqs.h"
     
    3837namespace orxonox
    3938{
    40 #ifdef GGZMOD_FOUND
    41     class _OrxonoxExport GGZClient;
    42 #endif /* GGZMOD_FOUND */
    43 
    4439    class _OrxonoxExport GSClient : public GameState<GSGraphics>, public GSLevel
    4540    {
     
    4742        GSClient();
    4843        ~GSClient();
     44        void connect(const std::string& address, int port);
    4945
    5046    private:
     
    5450
    5551        Client* client_;
    56 #ifdef GGZMOD_FOUND
    5752        GGZClient* ggzClient;
    58 #endif /* GGZMOD_FOUND */
    5953    };
    6054}
Note: See TracChangeset for help on using the changeset viewer.