2011-07-30 11:40:01 +00:00
|
|
|
#ifndef ENGINE_SHARED_ECON_H
|
|
|
|
#define ENGINE_SHARED_ECON_H
|
|
|
|
|
|
|
|
#include "network.h"
|
|
|
|
|
Make sure headers compile standalone
Not planning to do this automatically, but at least cleaning it up once
provides some benefit. Every header should include what it uses.
$ for i in src/**/*.h; do j=${i#"src/"}; echo $j; echo "#include <$j>\nint main() { return 0; }" | /usr/bin/c++ -DCONF_OPENSSL -DCONF_SQL -DCONF_VIDEORECORDER -DCONF_WAVPACK_CLOSE_FILE -DCONF_WAVPACK_OPEN_FILE_INPUT_EX -DGAME_RELEASE_VERSION=\"15.0.5\" -DGLEW_STATIC -D_FORTIFY_SOURCE=2 -I/usr/include/freetype2 -I/usr/include/opus -I/usr/include/SDL2 -I/usr/include/wavpack -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -Isrc -I/usr/include/mysql -I/home/deen/sys/include/ -O2 -g -DNDEBUG -fdiagnostics-color=always -fstack-protector-all -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wformat=2 -Wno-nullability-completeness -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wrestrict -std=gnu++11 -o /dev/null -x c++ -; done
Ignored: tuning.h, variables.h, config_common.h, mapitems_ex_types.h, mapbugs_list.h, protocol7.h, teehistorian_ex_chunks.h, protocol_ex_msgs.h, config.h, config_variables.h, external, keynames.h
2020-09-26 08:23:33 +00:00
|
|
|
#include <engine/console.h>
|
|
|
|
|
2021-01-10 12:47:07 +00:00
|
|
|
class CConfig;
|
|
|
|
|
2011-07-30 11:40:01 +00:00
|
|
|
class CEcon
|
|
|
|
{
|
2011-07-31 11:05:12 +00:00
|
|
|
enum
|
|
|
|
{
|
2020-09-26 19:41:58 +00:00
|
|
|
MAX_AUTH_TRIES = 3,
|
2011-07-31 11:05:12 +00:00
|
|
|
};
|
|
|
|
|
2011-07-30 11:40:01 +00:00
|
|
|
class CClient
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum
|
|
|
|
{
|
2020-09-26 19:41:58 +00:00
|
|
|
STATE_EMPTY = 0,
|
2011-07-30 11:40:01 +00:00
|
|
|
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];
|
|
|
|
|
2021-01-10 12:47:07 +00:00
|
|
|
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; }
|
|
|
|
|
2021-01-10 12:47:07 +00:00
|
|
|
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);
|
2011-07-31 00:20:46 +00:00
|
|
|
void Shutdown();
|
2011-07-30 11:40:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|