ddnet/src/engine/shared/econ.h

58 lines
1.2 KiB
C
Raw Normal View History

2011-07-30 11:40:01 +00:00
#ifndef ENGINE_SHARED_ECON_H
#define ENGINE_SHARED_ECON_H
#include "network.h"
#include <engine/console.h>
class CConfig;
2011-07-30 11:40:01 +00:00
class CEcon
{
enum
{
MAX_AUTH_TRIES = 3,
};
2011-07-30 11:40:01 +00:00
class CClient
{
public:
enum
{
STATE_EMPTY = 0,
2011-07-30 11:40:01 +00:00
STATE_CONNECTED,
STATE_AUTHED,
};
int m_State;
2021-06-23 05:05:49 +00:00
int64_t m_TimeConnected;
int m_AuthTries;
2011-07-30 11:40:01 +00:00
};
CClient m_aClients[NET_MAX_CONSOLE_CLIENTS];
CConfig *m_pConfig;
2011-07-30 11:40:01 +00:00
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
2021-03-08 00:08:38 +00:00
static void SendLineCB(const char *pLine, void *pUserData, ColorRGBA PrintColor = {1, 1, 1, 1});
2011-07-30 11:40:01 +00:00
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; }
void Init(CConfig *pConfig, IConsole *pConsole, class CNetBan *pNetBan);
2011-07-30 11:40:01 +00:00
void Update();
void Send(int ClientID, const char *pLine);
void Shutdown();
2011-07-30 11:40:01 +00:00
};
#endif