Manual preparation for cleaner clang-format

Also include what you use explicitly
This commit is contained in:
def 2020-09-25 18:11:59 +02:00
parent a5cf31040b
commit 0bac9f0de8
23 changed files with 178 additions and 172 deletions

View file

@ -2,12 +2,16 @@
Language: Cpp
AccessModifierOffset: -8
AlignAfterOpenBracket: DontAlign
AlignEscapedNewlines: DontAlign
AlignTrailingComments: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AlwaysBreakTemplateDeclarations: true
BasedOnStyle: LLVM
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
BreakStringLiterals: true
BraceWrapping:
AfterCaseLabel: true

View file

@ -22,18 +22,18 @@ void AntibotDump(void)
{
g_pData->m_pfnLog("null antibot", g_pData->m_pUser);
}
void AntibotOnPlayerInit(int ClientID) { (void)ClientID; }
void AntibotOnPlayerDestroy(int ClientID) { (void)ClientID; }
void AntibotOnSpawn(int ClientID) { (void)ClientID; }
void AntibotOnHammerFireReloading(int ClientID) { (void)ClientID; }
void AntibotOnHammerFire(int ClientID) { (void)ClientID; }
void AntibotOnHammerHit(int ClientID) { (void)ClientID; }
void AntibotOnDirectInput(int ClientID) { (void)ClientID; }
void AntibotOnCharacterTick(int ClientID) { (void)ClientID; }
void AntibotOnHookAttach(int ClientID, bool Player) { (void)ClientID; (void)Player; }
void AntibotOnPlayerInit(int /*ClientID*/) {}
void AntibotOnPlayerDestroy(int /*ClientID*/) {}
void AntibotOnSpawn(int /*ClientID*/) {}
void AntibotOnHammerFireReloading(int /*ClientID*/) {}
void AntibotOnHammerFire(int /*ClientID*/) {}
void AntibotOnHammerHit(int /*ClientID*/) {}
void AntibotOnDirectInput(int /*ClientID*/) {}
void AntibotOnCharacterTick(int /*ClientID*/) {}
void AntibotOnHookAttach(int /*ClientID*/, bool /*Player*/) {}
void AntibotOnEngineTick(void) {}
void AntibotOnEngineClientJoin(int ClientID, bool Sixup) { (void)ClientID; (void)Sixup; }
void AntibotOnEngineClientDrop(int ClientID, const char *pReason) { (void)ClientID; (void)pReason; }
void AntibotOnEngineClientMessage(int ClientID, const void *pData, int Size, int Flags) { (void)ClientID; (void)pData; (void)Size; (void)Flags; }
void AntibotOnEngineClientJoin(int /*ClientID*/, bool /*Sixup*/) {}
void AntibotOnEngineClientDrop(int /*ClientID*/, const char * /*pReason*/) {}
void AntibotOnEngineClientMessage(int /*ClientID*/, const void * /*pData*/, int /*Size*/, int /*Flags*/) {}
}

View file

@ -52,6 +52,7 @@
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <fcntl.h>
#include <direct.h>
#include <errno.h>
@ -3335,8 +3336,8 @@ int os_is_winxp_or_lower(void)
mem_zero(&ver, sizeof(OSVERSIONINFO));
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&ver);
return ver.dwMajorVersion < WINXP_MAJOR
|| (ver.dwMajorVersion == WINXP_MAJOR && ver.dwMinorVersion <= WINXP_MINOR);
return ver.dwMajorVersion < WINXP_MAJOR ||
(ver.dwMajorVersion == WINXP_MAJOR && ver.dwMinorVersion <= WINXP_MINOR);
#else
return 0;
#endif

View file

@ -3651,7 +3651,7 @@ static void ParseVersionString(const GLubyte* pStr, int& VersionMajor, int& Vers
char aCurNumberStr[32];
size_t CurNumberStrLen = 0;
size_t TotalNumbersPassed = 0;
int aNumbers[3] = { 0, };
int aNumbers[3] = { 0 };
bool LastWasNumber = false;
while(*pStr && TotalNumbersPassed < 3)
{

View file

@ -1380,8 +1380,8 @@ void CClient::ProcessServerInfo(int RawType, NETADDR *pFrom, const void *pData,
CServerInfo Info = {0};
int SavedType = SavedServerInfoType(RawType);
if((SavedType == SERVERINFO_64_LEGACY || SavedType == SERVERINFO_EXTENDED)
&& pEntry && pEntry->m_GotInfo && SavedType == pEntry->m_Info.m_Type)
if((SavedType == SERVERINFO_64_LEGACY || SavedType == SERVERINFO_EXTENDED) &&
pEntry && pEntry->m_GotInfo && SavedType == pEntry->m_Info.m_Type)
{
Info = pEntry->m_Info;
}
@ -2527,8 +2527,8 @@ void CClient::PumpNetwork()
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "client", aBuf);
}
if(State() != IClient::STATE_OFFLINE && State() < IClient::STATE_QUITING && m_DummyConnected
&& m_NetClient[CLIENT_DUMMY].State() == NETSTATE_OFFLINE)
if(State() != IClient::STATE_OFFLINE && State() < IClient::STATE_QUITING && m_DummyConnected &&
m_NetClient[CLIENT_DUMMY].State() == NETSTATE_OFFLINE)
{
DummyDisconnect(0);
char aBuf[256];
@ -3219,9 +3219,9 @@ void CClient::Run()
bool IsRenderActive = (g_Config.m_GfxBackgroundRender || m_pGraphics->WindowOpen());
if(IsRenderActive
&& (!g_Config.m_GfxAsyncRenderOld || m_pGraphics->IsIdle())
&& (!g_Config.m_GfxRefreshRate || (time_freq() / (int64)g_Config.m_GfxRefreshRate) <= Now - LastRenderTime))
if(IsRenderActive &&
(!g_Config.m_GfxAsyncRenderOld || m_pGraphics->IsIdle()) &&
(!g_Config.m_GfxRefreshRate || (time_freq() / (int64)g_Config.m_GfxRefreshRate) <= Now - LastRenderTime))
{
m_RenderFrames++;

View file

@ -2,6 +2,8 @@
#define ENGINE_CLIENT_DEMOEDIT_H
#include <engine/client/http.h>
#include <engine/shared/demo.h>
#include <engine/shared/snapshot.h>
#define CONNECTLINK "ddnet:"

View file

@ -2091,8 +2091,7 @@ int CGraphics_Threaded::Init()
0xff,0x00,0x00,0xff, 0xff,0x00,0x00,0xff, 0x00,0xff,0x00,0xff, 0x00,0xff,0x00,0xff,
0xff,0x00,0x00,0xff, 0xff,0x00,0x00,0xff, 0x00,0xff,0x00,0xff, 0x00,0xff,0x00,0xff,
0x00,0x00,0xff,0xff, 0x00,0x00,0xff,0xff, 0xff,0xff,0x00,0xff, 0xff,0xff,0x00,0xff,
0x00,0x00,0xff,0xff, 0x00,0x00,0xff,0xff, 0xff,0xff,0x00,0xff, 0xff,0xff,0x00,0xff,
};
0x00,0x00,0xff,0xff, 0x00,0x00,0xff,0xff, 0xff,0xff,0x00,0xff, 0xff,0xff,0x00,0xff};
m_InvalidTexture = LoadTextureRaw(4,4,CImageInfo::FORMAT_RGBA,s_aNullTextureData,CImageInfo::FORMAT_RGBA,TEXLOAD_NORESAMPLE);
return 0;

View file

@ -18,12 +18,11 @@ const double g_aSpeeds[] = {0.1, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 2.0, 3.0, 4.0,
typedef bool (*DEMOFUNC_FILTER)(const void *pData, int DataSize, void *pUser);
// TODO: Properly extend demo format using uuids
static const CUuid SHA256_EXTENSION = {{
// "6be6da4a-cebd-380c-9b5b-1289c842d780"
// "demoitem-sha256@ddnet.tw"
static const CUuid SHA256_EXTENSION = {{
0x6b, 0xe6, 0xda, 0x4a, 0xce, 0xbd, 0x38, 0x0c,
0x9b, 0x5b, 0x12, 0x89, 0xc8, 0x42, 0xd7, 0x80
}};
0x9b, 0x5b, 0x12, 0x89, 0xc8, 0x42, 0xd7, 0x80}};
struct CDemoHeader
{

3
src/engine/external/.clang-format vendored Normal file
View file

@ -0,0 +1,3 @@
DisableFormat: true
# clang-format bug: still sorts includes even if disabled
SortIncludes: false

View file

@ -18,9 +18,6 @@ protected:
public:
IInterface() : m_pKernel(0) {}
virtual ~IInterface() {}
//virtual unsigned InterfaceID() = 0;
//virtual const char *InterfaceName() = 0;
};
#define MACRO_INTERFACE(Name, ver) \
@ -28,10 +25,6 @@ public:
static const char *InterfaceName() { return Name; } \
private:
//virtual unsigned InterfaceID() { return INTERFACE_ID; }
//virtual const char *InterfaceName() { return name; }
// This kernel thingie makes the structure very flat and basiclly singletons.
// I'm not sure if this is a good idea but it works for now.
class IKernel

View file

@ -4,6 +4,7 @@
#define ENGINE_SERVER_REGISTER_H
#include <engine/masterserver.h>
#include <engine/shared/network.h>
class CRegister
{

View file

@ -3,6 +3,8 @@
#ifndef GAME_CLIENT_ANIMSTATE_H
#define GAME_CLIENT_ANIMSTATE_H
#include <game/generated/client_data.h>
class CAnimState
{
CAnimKeyframe m_Body;

View file

@ -4,6 +4,7 @@
#define GAME_CLIENT_COMPONENTS_GHOST_H
#include <game/client/component.h>
#include <game/client/components/menus.h>
enum
{

View file

@ -3,6 +3,8 @@
#ifndef GAME_EXTRAINFO_H
#define GAME_EXTRAINFO_H
#include <game/generated/protocol.h>
#include <base/vmath.h>
bool UseExtraInfo(const CNetObj_Projectile *pProj);

View file

@ -117,9 +117,9 @@ void CGun::Snap(int SnappingClient)
CCharacter *Char = GameServer()->GetPlayerChar(SnappingClient);
if(SnappingClient > -1 && (GameServer()->m_apPlayers[SnappingClient]->GetTeam() == -1
|| GameServer()->m_apPlayers[SnappingClient]->IsPaused())
&& GameServer()->m_apPlayers[SnappingClient]->m_SpectatorID != SPEC_FREEVIEW)
if(SnappingClient > -1 && (GameServer()->m_apPlayers[SnappingClient]->GetTeam() == -1 ||
GameServer()->m_apPlayers[SnappingClient]->IsPaused()) &&
GameServer()->m_apPlayers[SnappingClient]->m_SpectatorID != SPEC_FREEVIEW)
Char = GameServer()->GetPlayerChar(GameServer()->m_apPlayers[SnappingClient]->m_SpectatorID);
int Tick = (Server()->Tick()%Server()->TickSpeed())%11;

View file

@ -3,6 +3,8 @@
#ifndef GAME_SERVER_ENTITIES_PROJECTILE_H
#define GAME_SERVER_ENTITIES_PROJECTILE_H
#include <game/server/entity.h>
class CProjectile : public CEntity
{
public:

View file

@ -21,6 +21,8 @@
#include "player.h"
#include "teehistorian.h"
#include <memory>
#ifdef _MSC_VER
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;

View file

@ -1,8 +1,8 @@
#include "teehistorian.h"
#include <engine/shared/config.h>
#include <engine/shared/snapshot.h>
#include <engine/shared/json.h>
#include <engine/shared/snapshot.h>
#include <game/gamecore.h>
static const char TEEHISTORIAN_NAME[] = "teehistorian@ddnet.tw";
@ -184,7 +184,6 @@ void CTeeHistorian::WriteExtra(CUuid Uuid, const void *pData, int DataSize)
Write(pData, DataSize);
}
void CTeeHistorian::BeginTick(int Tick)
{
dbg_assert(m_State == STATE_START || m_State == STATE_BEFORE_TICK, "invalid teehistorian state");

View file

@ -49,8 +49,7 @@ protected:
0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x23, 0x45, 0x67, 0x89,
0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x23, 0x45, 0x67, 0x89,
0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x23, 0x45, 0x67, 0x89,
0x01, 0x23,
}};
0x01, 0x23}};
mem_zero(&m_GameInfo, sizeof(m_GameInfo));
@ -349,8 +348,7 @@ TEST_F(TeeHistorian, DDNetVersion)
};
CUuid ConnectionID = {
0xfb, 0x13, 0xa5, 0x76, 0xd3, 0x5f, 0x48, 0x93,
0xb8, 0x15, 0xee, 0xdc, 0x6d, 0x98, 0x01, 0x5b,
};
0xb8, 0x15, 0xee, 0xdc, 0x6d, 0x98, 0x01, 0x5b};
m_TH.RecordDDNetVersion(0, ConnectionID, 13010, "DDNet 13.1 (3623f5e4cd184556)");
m_TH.RecordDDNetVersionOld(1, 13010);
Finish();
@ -456,8 +454,7 @@ TEST_F(TeeHistorian, SaveSuccess)
CUuid SaveID = {
0xfb, 0x13, 0xa5, 0x76, 0xd3, 0x5f, 0x48, 0x93,
0xb8, 0x15, 0xee, 0xdc, 0x6d, 0x98, 0x01, 0x5b,
};
0xb8, 0x15, 0xee, 0xdc, 0x6d, 0x98, 0x01, 0x5b};
const char *pTeamSave = "2\tH.\nll0";
m_TH.RecordTeamSaveSuccess(21, SaveID, pTeamSave);
Finish();
@ -503,8 +500,7 @@ TEST_F(TeeHistorian, LoadSuccess)
CUuid SaveID = {
0xfb, 0x13, 0xa5, 0x76, 0xd3, 0x5f, 0x48, 0x93,
0xb8, 0x15, 0xee, 0xdc, 0x6d, 0x98, 0x01, 0x5b,
};
0xb8, 0x15, 0xee, 0xdc, 0x6d, 0x98, 0x01, 0x5b};
const char *pTeamSave = "2\tH.\nll0";
m_TH.RecordTeamLoadSuccess(21, SaveID, pTeamSave);
Finish();