Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 1, 2009, 5:35:16 PM (15 years ago)
Author:
landauf
Message:

merged ggz into ggz2

Location:
code/branches/ggz2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ggz2

  • code/branches/ggz2/src/modules/gamestates/GSClient.cc

    r5738 r5740  
    2424 *   Co-authors:
    2525 *      Fabian 'x3n' Landau
     26 *      Adrian Friedli
    2627 *
    2728 */
    2829
    2930#include "GSClient.h"
     31#include "SpecialConfig.h"
    3032
    3133#include "util/Exception.h"
     
    3537#include "core/GameMode.h"
    3638#include "network/Client.h"
     39#ifdef GGZMOD_FOUND
     40#include "GGZClient.h"
     41#endif /* GGZMOD_FOUND */
    3742
    3843namespace orxonox
     
    4550        : GameState(info)
    4651        , client_(0)
     52        , ggzClient(0)
    4753    {
    4854    }
     
    5662        GameMode::setIsClient(true);
    5763
    58         this->client_ = new Client(CommandLine::getValue("ip").getString(), CommandLine::getValue("port"));
     64#ifdef GGZMOD_FOUND
     65        if (GGZClient::isActive())
     66        {
     67            this->ggzClient = new GGZClient(this);
     68            return;
     69        }
     70#endif /* GGZMOD_FOUND */
     71
     72        this->connect(CommandLine::getValue("ip").getString(), CommandLine::getValue("port"));
     73    }
     74
     75    void GSClient::connect(const std::string& address, int port)
     76    {
     77        this->client_ = new Client(address, port);
    5978
    6079        if(!client_->establishConnection())
     
    6887        client_->closeConnection();
    6988
     89#ifdef GGZMOD_FOUND
     90        if (ggzClient)
     91        {
     92            delete ggzClient;
     93        }
     94#endif /* GGZMOD_FOUND */
     95
    7096        // destroy client
    7197        delete this->client_;
     
    76102    void GSClient::update(const Clock& time)
    77103    {
    78         client_->update(time);
     104        if (client_)
     105        {
     106            client_->update(time);
     107        }
    79108    }
    80109}
  • code/branches/ggz2/src/modules/gamestates/GSClient.h

    r5738 r5740  
    2323 *      Reto Grieder
    2424 *   Co-authors:
    25  *      ...
     25 *      Adrian Friedli
    2626 *
    2727 */
     
    4242        GSClient(const GameStateInfo& info);
    4343        ~GSClient();
     44        void connect(const std::string& address, int port);
    4445
    4546        void activate();
     
    4950    private:
    5051        Client* client_;
     52        GGZClient* ggzClient;
    5153    };
    5254}
Note: See TracChangeset for help on using the changeset viewer.