mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
2d01e00284
* woggaladriel -> vcmiainur * wogoliphaunt -> vcminoldor * wogshadowfax -> vcminahar * wogeyeofsauron -> vcmieagles * wogisengard -> vcmiformenos * wogsaruman -> vcmiistari * wogpathofthedead -> vcmiangband Minor changes.
58 lines
1.1 KiB
C++
58 lines
1.1 KiB
C++
#pragma once
|
|
#include "../global.h"
|
|
#include <boost/thread.hpp>
|
|
struct StartInfo;
|
|
class CGameState;
|
|
class CGameInterface;
|
|
class CConnection;
|
|
class CCallback;
|
|
class CClient;
|
|
void processCommand(const std::string &message, CClient *&client);
|
|
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;
|
|
}
|
|
};
|
|
|
|
class CClient
|
|
{
|
|
CCallback *cb;
|
|
CGameState *gs;
|
|
std::map<ui8,CGameInterface *> playerint;
|
|
CConnection *serv;
|
|
|
|
void waitForMoveAndSend(int color);
|
|
public:
|
|
CClient(void);
|
|
CClient(CConnection *con, StartInfo *si);
|
|
~CClient(void);
|
|
|
|
void close();
|
|
void process(int what);
|
|
void run();
|
|
|
|
friend class CCallback; //handling players actions
|
|
friend class CScriptCallback; //for objects scripts
|
|
friend void processCommand(const std::string &message, CClient *&client); //handling console
|
|
};
|