about summary refs log tree commit diff
path: root/src/engine/shared/econ.h
blob: 3ec19e28c64ee11678ee3cbde246783e50783398 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef ENGINE_SHARED_ECON_H
#define ENGINE_SHARED_ECON_H

#include "network.h"

class CEcon
{
	class CClient
	{
	public:
		enum
		{
			STATE_EMPTY=0,
			STATE_CONNECTED,
			STATE_AUTHED,
		};

		int m_State;
		int64 m_TimeConnected;
	};
	CClient m_aClients[NET_MAX_CONSOLE_CLIENTS];

	IConsole *m_pConsole;
	CNetConsole m_NetConsole;

	bool m_Ready;
	int m_PrintCBIndex;

	static void SendLineCB(const char *pLine, void *pUserData);
	static void ConchainEconOutputLevelUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);

	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(IConsole *pConsole);
	void Update();
	void Send(int ClientID, const char *pLine);
	void Shutdown();
};

#endif