2008-07-25 17:28:28 +00:00
|
|
|
#pragma once
|
|
|
|
#include "../global.h"
|
2008-08-04 09:05:52 +00:00
|
|
|
#include <boost/thread.hpp>
|
2008-07-25 17:28:28 +00:00
|
|
|
struct StartInfo;
|
|
|
|
class CGameState;
|
|
|
|
class CGameInterface;
|
|
|
|
class CConnection;
|
2008-07-27 17:07:37 +00:00
|
|
|
class CCallback;
|
2008-07-28 12:44:08 +00:00
|
|
|
|
|
|
|
namespace boost
|
|
|
|
{
|
|
|
|
class mutex;
|
|
|
|
class condition_variable;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct CSharedCond
|
|
|
|
{
|
|
|
|
boost::mutex *mx;
|
|
|
|
boost::condition_variable *cv;
|
|
|
|
T *res;
|
|
|
|
CSharedCond(T*R)
|
|
|
|
{
|
|
|
|
res = R;
|
|
|
|
mx = new boost::mutex;
|
|
|
|
cv = new boost::condition_variable;
|
|
|
|
}
|
|
|
|
~CSharedCond()
|
|
|
|
{
|
|
|
|
delete res;
|
|
|
|
delete mx;
|
|
|
|
delete cv;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-07-25 17:28:28 +00:00
|
|
|
class CClient
|
|
|
|
{
|
2008-08-13 00:44:31 +00:00
|
|
|
CCallback *cb;
|
2008-07-25 17:28:28 +00:00
|
|
|
CGameState *gs;
|
2008-07-28 12:44:08 +00:00
|
|
|
std::map<ui8,CGameInterface *> playerint;
|
2008-07-25 17:28:28 +00:00
|
|
|
CConnection *serv;
|
2008-08-04 15:56:36 +00:00
|
|
|
|
|
|
|
void waitForMoveAndSend(int color);
|
2008-07-25 17:28:28 +00:00
|
|
|
public:
|
|
|
|
CClient(void);
|
|
|
|
CClient(CConnection *con, StartInfo *si);
|
|
|
|
~CClient(void);
|
|
|
|
|
2008-08-25 10:25:16 +00:00
|
|
|
void close();
|
2008-07-25 17:28:28 +00:00
|
|
|
void process(int what);
|
|
|
|
void run();
|
2008-07-27 17:07:37 +00:00
|
|
|
|
|
|
|
friend class CCallback;
|
2008-07-28 12:44:08 +00:00
|
|
|
friend class CScriptCallback;
|
2008-07-25 17:28:28 +00:00
|
|
|
};
|