ddnet/src/engine/shared/econ.h
Alexander Akulich c2f276cee1 Port CConfig API from the upstream (0.7.5)
The old (g_Config) API is kept to not break the stuff.

See commits:
    de5859b371
    78076761eb
2021-01-10 17:10:19 +03:00

58 lines
1.1 KiB
C++

#ifndef ENGINE_SHARED_ECON_H
#define ENGINE_SHARED_ECON_H
#include "network.h"
#include <engine/console.h>
class CConfig;
class CEcon
{
enum
{
MAX_AUTH_TRIES = 3,
};
class CClient
{
public:
enum
{
STATE_EMPTY = 0,
STATE_CONNECTED,
STATE_AUTHED,
};
int m_State;
int64 m_TimeConnected;
int m_AuthTries;
};
CClient m_aClients[NET_MAX_CONSOLE_CLIENTS];
CConfig *m_pConfig;
IConsole *m_pConsole;
CNetConsole m_NetConsole;
bool m_Ready;
int m_PrintCBIndex;
int m_UserClientID;
static void SendLineCB(const char *pLine, void *pUserData, bool Highlighted);
static void ConchainEconOutputLevelUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
static void ConLogout(IConsole::IResult *pResult, void *pUserData);
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);
void Update();
void Send(int ClientID, const char *pLine);
void Shutdown();
};
#endif