ClientCx.hh

00001 /*
00002 ** Stechec project is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 2 of the License, or
00005 ** (at your option) any later version.
00006 **
00007 ** The complete GNU General Public Licence Notice can be found as the
00008 ** `NOTICE' file in the root directory.
00009 **
00010 ** Copyright (C) 2006, 2007 Prologin
00011 */
00012 
00013 #ifndef CLIENTCX_HH_
00014 # define CLIENTCX_HH_
00015 
00016 # include "tools.hh"
00017 # include "xml/xml_config.hh"
00018 # include "PacketSender.hh"
00019 # include "BaseCRules.hh"
00020 
00021 class Cx;
00022 
00030 class ClientCx : public PacketSender
00031 {
00032 public:
00033   ClientCx();
00034   virtual ~ClientCx();
00035 
00039   bool          connect(xml::XMLConfig& cfg);
00040 
00045   bool      join(xml::XMLConfig& cfg, const struct RuleDescription& desc);
00046     
00049   bool          openLog(const std::string& filename);
00050 
00052   void          disconnect(bool send_abort = false);
00053 
00055   bool          isConnected() const;
00056   
00059   bool          process(bool block = false);
00060 
00062   void      setRules(BaseCRules* rules);
00063 
00065   void      setClientGameId(int client_gid);
00066   
00069   void          setReady();
00070 
00071 private:
00073   virtual void  sendPacket(const Packet& p);
00074 
00075   virtual void  gameFinished();
00076 
00078   bool          connect(const std::string& host, int port);
00079   bool          join(int game_uid, bool wanna_be_viewer, const struct RuleDescription& desc);
00080 
00082   void          createDirectCx(int uid);
00083   bool          syncArbiter();
00084 
00085   Cx*           cx_;
00086   BaseCRules*   rules_;
00087   int           client_gid_;
00088 };
00089 
00090 #endif /* !CLIENTCX_HH_ */

Generated on Sat Jun 23 16:07:22 2007 for Stechec/TBT by  doxygen 1.4.7