ddnet/src/engine/server/antibot.h
heinrich5991 17402cc43f Rename all variables for strict camel-casing of abbreviations
This is the strict version, ID → Id, UI → Ui, except DDNet which stays
DDNet.

This would fix #7750.

Done using a naive rename script (for bash, use `shopt -s globstar`):

```fish
sed -i \
	-e 's/\([a-z]_\?\)ID/\1Id/g' \
	-e 's/\([^ ]\)\<UI\>/\1Ui/g' \
	-e 's/UI()/Ui()/g' \
	-e 's/\<CUI\>/CUi/g' \
	-e 's/\([\ta-z.(&]\|[,=|] \)ID\>/\1Id/g' \
	-e 's/\<ID\>\([^ ").]\)/Id\1/g' \
	-e 's/\<ID\([0-9]\)/Id\1/g' \
	-e 's/\<ID\>\( [<=>:+*/-]\)/Id\1/g' \
	-e 's/int ID/int Id/g' \
	-e 's/\([a-z]_\?\)GPU/\1Gpu/g' \
	-e 's/\([a-z]_\?\)IP/\1Ip/g' \
	-e 's/\([a-z]_\?\)CID/\1Cid/g' \
	-e 's/\([a-z]_\?\)MySQL/\1Mysql/g' \
	-e 's/MySql/Mysql/g' \
	-e 's/\([a-xz]_\?\)SQL/\1Sql/g' \
	-e 's/DPMode/DpMode/g' \
	-e 's/TTWGraphics/TTwGraphics/g' \
	\
	-e 's/Ipointer/IPointer/g' \
	-e 's/\.vendorId/.vendorID/g' \
	-e 's/\.windowId/.windowID/g' \
	-e 's/SDL_GetWindowFromId/SDL_GetWindowFromID/g' \
	-e 's/SDL_AudioDeviceId/SDL_AudioDeviceID/g' \
	-e 's/SDL_JoystickId/SDL_JoystickID/g' \
	-e 's/SDL_JoystickInstanceId/SDL_JoystickInstanceID/g' \
	-e 's/AVCodecId/AVCodecID/g' \
	src/**/*.cpp src/**/*.h {datasrc,scripts}/**/*.py
git checkout -- src/engine/external
```

I like this option because it presents clear rules.

Still needs fixups because of the naive replacement, I'd do this if we
want this merged.
2024-03-05 15:44:09 +01:00

62 lines
2 KiB
C++

#ifndef ENGINE_SERVER_ANTIBOT_H
#define ENGINE_SERVER_ANTIBOT_H
#include <antibot/antibot_data.h>
#include <engine/antibot.h>
class CAntibot : public IEngineAntibot
{
class IServer *m_pServer;
class IConsole *m_pConsole;
class IGameServer *m_pGameServer;
class IServer *Server() const { return m_pServer; }
class IConsole *Console() const { return m_pConsole; }
class IGameServer *GameServer() const { return m_pGameServer; }
CAntibotData m_Data;
CAntibotRoundData m_RoundData;
bool m_Initialized;
void Update();
static void Kick(int ClientId, const char *pMessage, void *pUser);
static void Log(const char *pMessage, void *pUser);
static void Report(int ClientId, const char *pMessage, void *pUser);
static void Send(int ClientId, const void *pData, int Size, int Flags, void *pUser);
static void Teehistorian(const void *pData, int Size, void *pUser);
public:
CAntibot();
virtual ~CAntibot();
// Engine
void Init() override;
void OnEngineTick() override;
void OnEngineClientJoin(int ClientId, bool Sixup) override;
void OnEngineClientDrop(int ClientId, const char *pReason) override;
bool OnEngineClientMessage(int ClientId, const void *pData, int Size, int Flags) override;
bool OnEngineServerMessage(int ClientId, const void *pData, int Size, int Flags) override;
bool OnEngineSimulateClientMessage(int *pClientId, void *pBuffer, int BufferSize, int *pOutSize, int *pFlags) override;
// Game
void RoundStart(class IGameServer *pGameServer) override;
void RoundEnd() override;
void OnPlayerInit(int ClientId) override;
void OnPlayerDestroy(int ClientId) override;
void OnSpawn(int ClientId) override;
void OnHammerFireReloading(int ClientId) override;
void OnHammerFire(int ClientId) override;
void OnHammerHit(int ClientId, int TargetId) override;
void OnDirectInput(int ClientId) override;
void OnCharacterTick(int ClientId) override;
void OnHookAttach(int ClientId, bool Player) override;
void ConsoleCommand(const char *pCommand) override;
};
extern IEngineAntibot *CreateEngineAntibot();
#endif // ENGINE_SERVER_ANTIBOT_H