2011-07-30 11:40:01 +00:00
|
|
|
#ifndef ENGINE_SHARED_ECON_H
|
|
|
|
#define ENGINE_SHARED_ECON_H
|
|
|
|
|
|
|
|
#include "network.h"
|
|
|
|
|
2011-12-29 22:36:53 +00:00
|
|
|
|
2011-07-30 11:40:01 +00:00
|
|
|
class CEcon
|
|
|
|
{
|
2011-07-31 11:05:12 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
MAX_AUTH_TRIES=3,
|
|
|
|
};
|
|
|
|
|
2011-07-30 11:40:01 +00:00
|
|
|
class CClient
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
STATE_EMPTY=0,
|
|
|
|
STATE_CONNECTED,
|
|
|
|
STATE_AUTHED,
|
|
|
|
};
|
|
|
|
|
|
|
|
int m_State;
|
|
|
|
int64 m_TimeConnected;
|
2011-07-31 11:05:12 +00:00
|
|
|
int m_AuthTries;
|
2011-07-30 11:40:01 +00:00
|
|
|
};
|
|
|
|
CClient m_aClients[NET_MAX_CONSOLE_CLIENTS];
|
|
|
|
|
|
|
|
IConsole *m_pConsole;
|
|
|
|
CNetConsole m_NetConsole;
|
|
|
|
|
|
|
|
bool m_Ready;
|
|
|
|
int m_PrintCBIndex;
|
2011-12-30 18:12:31 +00:00
|
|
|
int m_UserClientID;
|
2011-07-30 11:40:01 +00:00
|
|
|
|
|
|
|
static void SendLineCB(const char *pLine, void *pUserData);
|
|
|
|
static void ConchainEconOutputLevelUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
2011-12-30 18:12:31 +00:00
|
|
|
static void ConLogout(IConsole::IResult *pResult, void *pUserData);
|
2011-07-30 11:40:01 +00:00
|
|
|
|
|
|
|
static int NewClientCallback(int ClientID, void *pUser);
|
|
|
|
static int DelClientCallback(int ClientID, const char *pReason, void *pUser);
|
|
|
|
|
|
|
|
public:
|
|
|
|
IConsole *Console() { return m_pConsole; }
|
|
|
|
|
2011-12-29 22:36:53 +00:00
|
|
|
void Init(IConsole *pConsole, class CNetBan *pNetBan);
|
2011-07-30 11:40:01 +00:00
|
|
|
void Update();
|
|
|
|
void Send(int ClientID, const char *pLine);
|
2011-07-31 00:20:46 +00:00
|
|
|
void Shutdown();
|
2011-07-30 11:40:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|