mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38:19 +00:00
Manual preparation for cleaner clang-format
Also include what you use explicitly
This commit is contained in:
parent
a5cf31040b
commit
0bac9f0de8
|
@ -2,12 +2,16 @@
|
||||||
Language: Cpp
|
Language: Cpp
|
||||||
AccessModifierOffset: -8
|
AccessModifierOffset: -8
|
||||||
AlignAfterOpenBracket: DontAlign
|
AlignAfterOpenBracket: DontAlign
|
||||||
|
AlignEscapedNewlines: DontAlign
|
||||||
AlignTrailingComments: false
|
AlignTrailingComments: false
|
||||||
AllowShortFunctionsOnASingleLine: Inline
|
AllowShortBlocksOnASingleLine: Always
|
||||||
|
AllowShortCaseLabelsOnASingleLine: true
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
AlwaysBreakTemplateDeclarations: true
|
AlwaysBreakTemplateDeclarations: true
|
||||||
BasedOnStyle: LLVM
|
BasedOnStyle: LLVM
|
||||||
BreakBeforeBraces: Custom
|
BreakBeforeBraces: Custom
|
||||||
BreakBeforeTernaryOperators: false
|
BreakBeforeTernaryOperators: false
|
||||||
|
BreakConstructorInitializers: AfterColon
|
||||||
BreakStringLiterals: true
|
BreakStringLiterals: true
|
||||||
BraceWrapping:
|
BraceWrapping:
|
||||||
AfterCaseLabel: true
|
AfterCaseLabel: true
|
||||||
|
|
|
@ -30,9 +30,9 @@ struct CAntibotInputData
|
||||||
// Defined by the network protocol, unlikely to change.
|
// Defined by the network protocol, unlikely to change.
|
||||||
//enum
|
//enum
|
||||||
//{
|
//{
|
||||||
//TEAM_SPECTATORS=-1,
|
// TEAM_SPECTATORS=-1,
|
||||||
//TEAM_RED=0,
|
// TEAM_RED=0,
|
||||||
//TEAM_BLUE=1,
|
// TEAM_BLUE=1,
|
||||||
//};
|
//};
|
||||||
|
|
||||||
struct CAntibotCharacterData
|
struct CAntibotCharacterData
|
||||||
|
|
|
@ -22,18 +22,18 @@ void AntibotDump(void)
|
||||||
{
|
{
|
||||||
g_pData->m_pfnLog("null antibot", g_pData->m_pUser);
|
g_pData->m_pfnLog("null antibot", g_pData->m_pUser);
|
||||||
}
|
}
|
||||||
void AntibotOnPlayerInit(int ClientID) { (void)ClientID; }
|
void AntibotOnPlayerInit(int /*ClientID*/) {}
|
||||||
void AntibotOnPlayerDestroy(int ClientID) { (void)ClientID; }
|
void AntibotOnPlayerDestroy(int /*ClientID*/) {}
|
||||||
void AntibotOnSpawn(int ClientID) { (void)ClientID; }
|
void AntibotOnSpawn(int /*ClientID*/) {}
|
||||||
void AntibotOnHammerFireReloading(int ClientID) { (void)ClientID; }
|
void AntibotOnHammerFireReloading(int /*ClientID*/) {}
|
||||||
void AntibotOnHammerFire(int ClientID) { (void)ClientID; }
|
void AntibotOnHammerFire(int /*ClientID*/) {}
|
||||||
void AntibotOnHammerHit(int ClientID) { (void)ClientID; }
|
void AntibotOnHammerHit(int /*ClientID*/) {}
|
||||||
void AntibotOnDirectInput(int ClientID) { (void)ClientID; }
|
void AntibotOnDirectInput(int /*ClientID*/) {}
|
||||||
void AntibotOnCharacterTick(int ClientID) { (void)ClientID; }
|
void AntibotOnCharacterTick(int /*ClientID*/) {}
|
||||||
void AntibotOnHookAttach(int ClientID, bool Player) { (void)ClientID; (void)Player; }
|
void AntibotOnHookAttach(int /*ClientID*/, bool /*Player*/) {}
|
||||||
void AntibotOnEngineTick(void) { }
|
void AntibotOnEngineTick(void) {}
|
||||||
void AntibotOnEngineClientJoin(int ClientID, bool Sixup) { (void)ClientID; (void)Sixup; }
|
void AntibotOnEngineClientJoin(int /*ClientID*/, bool /*Sixup*/) {}
|
||||||
void AntibotOnEngineClientDrop(int ClientID, const char *pReason) { (void)ClientID; (void)pReason; }
|
void AntibotOnEngineClientDrop(int /*ClientID*/, const char * /*pReason*/) {}
|
||||||
void AntibotOnEngineClientMessage(int ClientID, const void *pData, int Size, int Flags) { (void)ClientID; (void)pData; (void)Size; (void)Flags; }
|
void AntibotOnEngineClientMessage(int /*ClientID*/, const void * /*pData*/, int /*Size*/, int /*Flags*/) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -3335,8 +3336,8 @@ int os_is_winxp_or_lower(void)
|
||||||
mem_zero(&ver, sizeof(OSVERSIONINFO));
|
mem_zero(&ver, sizeof(OSVERSIONINFO));
|
||||||
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||||
GetVersionEx(&ver);
|
GetVersionEx(&ver);
|
||||||
return ver.dwMajorVersion < WINXP_MAJOR
|
return ver.dwMajorVersion < WINXP_MAJOR ||
|
||||||
|| (ver.dwMajorVersion == WINXP_MAJOR && ver.dwMinorVersion <= WINXP_MINOR);
|
(ver.dwMajorVersion == WINXP_MAJOR && ver.dwMinorVersion <= WINXP_MINOR);
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3651,7 +3651,7 @@ static void ParseVersionString(const GLubyte* pStr, int& VersionMajor, int& Vers
|
||||||
char aCurNumberStr[32];
|
char aCurNumberStr[32];
|
||||||
size_t CurNumberStrLen = 0;
|
size_t CurNumberStrLen = 0;
|
||||||
size_t TotalNumbersPassed = 0;
|
size_t TotalNumbersPassed = 0;
|
||||||
int aNumbers[3] = { 0, };
|
int aNumbers[3] = { 0 };
|
||||||
bool LastWasNumber = false;
|
bool LastWasNumber = false;
|
||||||
while(*pStr && TotalNumbersPassed < 3)
|
while(*pStr && TotalNumbersPassed < 3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1380,8 +1380,8 @@ void CClient::ProcessServerInfo(int RawType, NETADDR *pFrom, const void *pData,
|
||||||
|
|
||||||
CServerInfo Info = {0};
|
CServerInfo Info = {0};
|
||||||
int SavedType = SavedServerInfoType(RawType);
|
int SavedType = SavedServerInfoType(RawType);
|
||||||
if((SavedType == SERVERINFO_64_LEGACY || SavedType == SERVERINFO_EXTENDED)
|
if((SavedType == SERVERINFO_64_LEGACY || SavedType == SERVERINFO_EXTENDED) &&
|
||||||
&& pEntry && pEntry->m_GotInfo && SavedType == pEntry->m_Info.m_Type)
|
pEntry && pEntry->m_GotInfo && SavedType == pEntry->m_Info.m_Type)
|
||||||
{
|
{
|
||||||
Info = pEntry->m_Info;
|
Info = pEntry->m_Info;
|
||||||
}
|
}
|
||||||
|
@ -2527,8 +2527,8 @@ void CClient::PumpNetwork()
|
||||||
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "client", aBuf);
|
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "client", aBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(State() != IClient::STATE_OFFLINE && State() < IClient::STATE_QUITING && m_DummyConnected
|
if(State() != IClient::STATE_OFFLINE && State() < IClient::STATE_QUITING && m_DummyConnected &&
|
||||||
&& m_NetClient[CLIENT_DUMMY].State() == NETSTATE_OFFLINE)
|
m_NetClient[CLIENT_DUMMY].State() == NETSTATE_OFFLINE)
|
||||||
{
|
{
|
||||||
DummyDisconnect(0);
|
DummyDisconnect(0);
|
||||||
char aBuf[256];
|
char aBuf[256];
|
||||||
|
@ -3219,9 +3219,9 @@ void CClient::Run()
|
||||||
|
|
||||||
bool IsRenderActive = (g_Config.m_GfxBackgroundRender || m_pGraphics->WindowOpen());
|
bool IsRenderActive = (g_Config.m_GfxBackgroundRender || m_pGraphics->WindowOpen());
|
||||||
|
|
||||||
if(IsRenderActive
|
if(IsRenderActive &&
|
||||||
&& (!g_Config.m_GfxAsyncRenderOld || m_pGraphics->IsIdle())
|
(!g_Config.m_GfxAsyncRenderOld || m_pGraphics->IsIdle()) &&
|
||||||
&& (!g_Config.m_GfxRefreshRate || (time_freq() / (int64)g_Config.m_GfxRefreshRate) <= Now - LastRenderTime))
|
(!g_Config.m_GfxRefreshRate || (time_freq() / (int64)g_Config.m_GfxRefreshRate) <= Now - LastRenderTime))
|
||||||
{
|
{
|
||||||
m_RenderFrames++;
|
m_RenderFrames++;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define ENGINE_CLIENT_DEMOEDIT_H
|
#define ENGINE_CLIENT_DEMOEDIT_H
|
||||||
|
|
||||||
#include <engine/client/http.h>
|
#include <engine/client/http.h>
|
||||||
|
#include <engine/shared/demo.h>
|
||||||
|
#include <engine/shared/snapshot.h>
|
||||||
|
|
||||||
#define CONNECTLINK "ddnet:"
|
#define CONNECTLINK "ddnet:"
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
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,
|
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);
|
m_InvalidTexture = LoadTextureRaw(4,4,CImageInfo::FORMAT_RGBA,s_aNullTextureData,CImageInfo::FORMAT_RGBA,TEXLOAD_NORESAMPLE);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -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);
|
typedef bool (*DEMOFUNC_FILTER)(const void *pData, int DataSize, void *pUser);
|
||||||
|
|
||||||
// TODO: Properly extend demo format using uuids
|
// TODO: Properly extend demo format using uuids
|
||||||
|
// "6be6da4a-cebd-380c-9b5b-1289c842d780"
|
||||||
|
// "demoitem-sha256@ddnet.tw"
|
||||||
static const CUuid SHA256_EXTENSION = {{
|
static const CUuid SHA256_EXTENSION = {{
|
||||||
// "6be6da4a-cebd-380c-9b5b-1289c842d780"
|
|
||||||
// "demoitem-sha256@ddnet.tw"
|
|
||||||
0x6b, 0xe6, 0xda, 0x4a, 0xce, 0xbd, 0x38, 0x0c,
|
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
|
struct CDemoHeader
|
||||||
{
|
{
|
||||||
|
|
3
src/engine/external/.clang-format
vendored
Normal file
3
src/engine/external/.clang-format
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
DisableFormat: true
|
||||||
|
# clang-format bug: still sorts includes even if disabled
|
||||||
|
SortIncludes: false
|
|
@ -18,9 +18,6 @@ protected:
|
||||||
public:
|
public:
|
||||||
IInterface() : m_pKernel(0) {}
|
IInterface() : m_pKernel(0) {}
|
||||||
virtual ~IInterface() {}
|
virtual ~IInterface() {}
|
||||||
|
|
||||||
//virtual unsigned InterfaceID() = 0;
|
|
||||||
//virtual const char *InterfaceName() = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MACRO_INTERFACE(Name, ver) \
|
#define MACRO_INTERFACE(Name, ver) \
|
||||||
|
@ -28,10 +25,6 @@ public:
|
||||||
static const char *InterfaceName() { return Name; } \
|
static const char *InterfaceName() { return Name; } \
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//virtual unsigned InterfaceID() { return INTERFACE_ID; }
|
|
||||||
//virtual const char *InterfaceName() { return name; }
|
|
||||||
|
|
||||||
|
|
||||||
// This kernel thingie makes the structure very flat and basiclly singletons.
|
// 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.
|
// I'm not sure if this is a good idea but it works for now.
|
||||||
class IKernel
|
class IKernel
|
||||||
|
|
|
@ -6,23 +6,23 @@ void IDbConnection::FormatCreateRace(char *aBuf, unsigned int BufferSize)
|
||||||
{
|
{
|
||||||
str_format(aBuf, BufferSize,
|
str_format(aBuf, BufferSize,
|
||||||
"CREATE TABLE IF NOT EXISTS %s_race ("
|
"CREATE TABLE IF NOT EXISTS %s_race ("
|
||||||
"Map VARCHAR(128) COLLATE %s NOT NULL, "
|
" Map VARCHAR(128) COLLATE %s NOT NULL, "
|
||||||
"Name VARCHAR(%d) COLLATE %s NOT NULL, "
|
" Name VARCHAR(%d) COLLATE %s NOT NULL, "
|
||||||
"Timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, "
|
" Timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, "
|
||||||
"Time FLOAT DEFAULT 0, "
|
" Time FLOAT DEFAULT 0, "
|
||||||
"Server CHAR(4), "
|
" Server CHAR(4), "
|
||||||
"cp1 FLOAT DEFAULT 0, cp2 FLOAT DEFAULT 0, cp3 FLOAT DEFAULT 0, "
|
" cp1 FLOAT DEFAULT 0, cp2 FLOAT DEFAULT 0, cp3 FLOAT DEFAULT 0, "
|
||||||
"cp4 FLOAT DEFAULT 0, cp5 FLOAT DEFAULT 0, cp6 FLOAT DEFAULT 0, "
|
" cp4 FLOAT DEFAULT 0, cp5 FLOAT DEFAULT 0, cp6 FLOAT DEFAULT 0, "
|
||||||
"cp7 FLOAT DEFAULT 0, cp8 FLOAT DEFAULT 0, cp9 FLOAT DEFAULT 0, "
|
" cp7 FLOAT DEFAULT 0, cp8 FLOAT DEFAULT 0, cp9 FLOAT DEFAULT 0, "
|
||||||
"cp10 FLOAT DEFAULT 0, cp11 FLOAT DEFAULT 0, cp12 FLOAT DEFAULT 0, "
|
" cp10 FLOAT DEFAULT 0, cp11 FLOAT DEFAULT 0, cp12 FLOAT DEFAULT 0, "
|
||||||
"cp13 FLOAT DEFAULT 0, cp14 FLOAT DEFAULT 0, cp15 FLOAT DEFAULT 0, "
|
" cp13 FLOAT DEFAULT 0, cp14 FLOAT DEFAULT 0, cp15 FLOAT DEFAULT 0, "
|
||||||
"cp16 FLOAT DEFAULT 0, cp17 FLOAT DEFAULT 0, cp18 FLOAT DEFAULT 0, "
|
" cp16 FLOAT DEFAULT 0, cp17 FLOAT DEFAULT 0, cp18 FLOAT DEFAULT 0, "
|
||||||
"cp19 FLOAT DEFAULT 0, cp20 FLOAT DEFAULT 0, cp21 FLOAT DEFAULT 0, "
|
" cp19 FLOAT DEFAULT 0, cp20 FLOAT DEFAULT 0, cp21 FLOAT DEFAULT 0, "
|
||||||
"cp22 FLOAT DEFAULT 0, cp23 FLOAT DEFAULT 0, cp24 FLOAT DEFAULT 0, "
|
" cp22 FLOAT DEFAULT 0, cp23 FLOAT DEFAULT 0, cp24 FLOAT DEFAULT 0, "
|
||||||
"cp25 FLOAT DEFAULT 0, "
|
" cp25 FLOAT DEFAULT 0, "
|
||||||
"GameID VARCHAR(64), "
|
" GameID VARCHAR(64), "
|
||||||
"DDNet7 BOOL DEFAULT FALSE, "
|
" DDNet7 BOOL DEFAULT FALSE, "
|
||||||
"PRIMARY KEY (Map, Name, Time, Timestamp, Server)"
|
" PRIMARY KEY (Map, Name, Time, Timestamp, Server)"
|
||||||
");",
|
");",
|
||||||
GetPrefix(), BinaryCollate(), MAX_NAME_LENGTH, BinaryCollate());
|
GetPrefix(), BinaryCollate(), MAX_NAME_LENGTH, BinaryCollate());
|
||||||
}
|
}
|
||||||
|
@ -31,14 +31,14 @@ void IDbConnection::FormatCreateTeamrace(char *aBuf, unsigned int BufferSize, co
|
||||||
{
|
{
|
||||||
str_format(aBuf, BufferSize,
|
str_format(aBuf, BufferSize,
|
||||||
"CREATE TABLE IF NOT EXISTS %s_teamrace ("
|
"CREATE TABLE IF NOT EXISTS %s_teamrace ("
|
||||||
"Map VARCHAR(128) COLLATE %s NOT NULL, "
|
" Map VARCHAR(128) COLLATE %s NOT NULL, "
|
||||||
"Name VARCHAR(%d) COLLATE %s NOT NULL, "
|
" Name VARCHAR(%d) COLLATE %s NOT NULL, "
|
||||||
"Timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, "
|
" Timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, "
|
||||||
"Time FLOAT DEFAULT 0, "
|
" Time FLOAT DEFAULT 0, "
|
||||||
"ID %s NOT NULL, " // VARBINARY(16) for MySQL and BLOB for SQLite
|
" ID %s NOT NULL, " // VARBINARY(16) for MySQL and BLOB for SQLite
|
||||||
"GameID VARCHAR(64), "
|
" GameID VARCHAR(64), "
|
||||||
"DDNet7 BOOL DEFAULT FALSE, "
|
" DDNet7 BOOL DEFAULT FALSE, "
|
||||||
"PRIMARY KEY (ID, Name)"
|
" PRIMARY KEY (ID, Name)"
|
||||||
");",
|
");",
|
||||||
GetPrefix(), BinaryCollate(), MAX_NAME_LENGTH, BinaryCollate(), pIdType);
|
GetPrefix(), BinaryCollate(), MAX_NAME_LENGTH, BinaryCollate(), pIdType);
|
||||||
}
|
}
|
||||||
|
@ -47,13 +47,13 @@ void IDbConnection::FormatCreateMaps(char *aBuf, unsigned int BufferSize)
|
||||||
{
|
{
|
||||||
str_format(aBuf, BufferSize,
|
str_format(aBuf, BufferSize,
|
||||||
"CREATE TABLE IF NOT EXISTS %s_maps ("
|
"CREATE TABLE IF NOT EXISTS %s_maps ("
|
||||||
"Map VARCHAR(128) COLLATE %s NOT NULL, "
|
" Map VARCHAR(128) COLLATE %s NOT NULL, "
|
||||||
"Server VARCHAR(32) COLLATE %s NOT NULL, "
|
" Server VARCHAR(32) COLLATE %s NOT NULL, "
|
||||||
"Mapper VARCHAR(128) COLLATE %s NOT NULL, "
|
" Mapper VARCHAR(128) COLLATE %s NOT NULL, "
|
||||||
"Points INT DEFAULT 0, "
|
" Points INT DEFAULT 0, "
|
||||||
"Stars INT DEFAULT 0, "
|
" Stars INT DEFAULT 0, "
|
||||||
"Timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP, "
|
" Timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP, "
|
||||||
"PRIMARY KEY (Map)"
|
" PRIMARY KEY (Map)"
|
||||||
");",
|
");",
|
||||||
GetPrefix(), BinaryCollate(), BinaryCollate(), BinaryCollate());
|
GetPrefix(), BinaryCollate(), BinaryCollate(), BinaryCollate());
|
||||||
}
|
}
|
||||||
|
@ -62,14 +62,14 @@ void IDbConnection::FormatCreateSaves(char *aBuf, unsigned int BufferSize)
|
||||||
{
|
{
|
||||||
str_format(aBuf, BufferSize,
|
str_format(aBuf, BufferSize,
|
||||||
"CREATE TABLE IF NOT EXISTS %s_saves ("
|
"CREATE TABLE IF NOT EXISTS %s_saves ("
|
||||||
"Savegame TEXT COLLATE %s NOT NULL, "
|
" Savegame TEXT COLLATE %s NOT NULL, "
|
||||||
"Map VARCHAR(128) COLLATE %s NOT NULL, "
|
" Map VARCHAR(128) COLLATE %s NOT NULL, "
|
||||||
"Code VARCHAR(128) COLLATE %s NOT NULL, "
|
" Code VARCHAR(128) COLLATE %s NOT NULL, "
|
||||||
"Timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, "
|
" Timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, "
|
||||||
"Server CHAR(4), "
|
" Server CHAR(4), "
|
||||||
"DDNet7 BOOL DEFAULT FALSE, "
|
" DDNet7 BOOL DEFAULT FALSE, "
|
||||||
"SaveID VARCHAR(36) DEFAULT NULL, "
|
" SaveID VARCHAR(36) DEFAULT NULL, "
|
||||||
"PRIMARY KEY (Map, Code)"
|
" PRIMARY KEY (Map, Code)"
|
||||||
");",
|
");",
|
||||||
GetPrefix(), BinaryCollate(), BinaryCollate(), BinaryCollate());
|
GetPrefix(), BinaryCollate(), BinaryCollate(), BinaryCollate());
|
||||||
}
|
}
|
||||||
|
@ -78,9 +78,9 @@ void IDbConnection::FormatCreatePoints(char *aBuf, unsigned int BufferSize)
|
||||||
{
|
{
|
||||||
str_format(aBuf, BufferSize,
|
str_format(aBuf, BufferSize,
|
||||||
"CREATE TABLE IF NOT EXISTS %s_points ("
|
"CREATE TABLE IF NOT EXISTS %s_points ("
|
||||||
"Name VARCHAR(%d) COLLATE %s NOT NULL, "
|
" Name VARCHAR(%d) COLLATE %s NOT NULL, "
|
||||||
"Points INT DEFAULT 0, "
|
" Points INT DEFAULT 0, "
|
||||||
"PRIMARY KEY (Name)"
|
" PRIMARY KEY (Name)"
|
||||||
");",
|
");",
|
||||||
GetPrefix(), MAX_NAME_LENGTH, BinaryCollate());
|
GetPrefix(), MAX_NAME_LENGTH, BinaryCollate());
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#define ENGINE_SERVER_REGISTER_H
|
#define ENGINE_SERVER_REGISTER_H
|
||||||
|
|
||||||
#include <engine/masterserver.h>
|
#include <engine/masterserver.h>
|
||||||
|
#include <engine/shared/network.h>
|
||||||
|
|
||||||
class CRegister
|
class CRegister
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#ifndef GAME_CLIENT_ANIMSTATE_H
|
#ifndef GAME_CLIENT_ANIMSTATE_H
|
||||||
#define GAME_CLIENT_ANIMSTATE_H
|
#define GAME_CLIENT_ANIMSTATE_H
|
||||||
|
|
||||||
|
#include <game/generated/client_data.h>
|
||||||
|
|
||||||
class CAnimState
|
class CAnimState
|
||||||
{
|
{
|
||||||
CAnimKeyframe m_Body;
|
CAnimKeyframe m_Body;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#define GAME_CLIENT_COMPONENTS_GHOST_H
|
#define GAME_CLIENT_COMPONENTS_GHOST_H
|
||||||
|
|
||||||
#include <game/client/component.h>
|
#include <game/client/component.h>
|
||||||
|
#include <game/client/components/menus.h>
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#ifndef GAME_EXTRAINFO_H
|
#ifndef GAME_EXTRAINFO_H
|
||||||
#define GAME_EXTRAINFO_H
|
#define GAME_EXTRAINFO_H
|
||||||
|
|
||||||
|
#include <game/generated/protocol.h>
|
||||||
|
|
||||||
#include <base/vmath.h>
|
#include <base/vmath.h>
|
||||||
|
|
||||||
bool UseExtraInfo(const CNetObj_Projectile *pProj);
|
bool UseExtraInfo(const CNetObj_Projectile *pProj);
|
||||||
|
|
|
@ -117,9 +117,9 @@ void CGun::Snap(int SnappingClient)
|
||||||
|
|
||||||
CCharacter *Char = GameServer()->GetPlayerChar(SnappingClient);
|
CCharacter *Char = GameServer()->GetPlayerChar(SnappingClient);
|
||||||
|
|
||||||
if(SnappingClient > -1 && (GameServer()->m_apPlayers[SnappingClient]->GetTeam() == -1
|
if(SnappingClient > -1 && (GameServer()->m_apPlayers[SnappingClient]->GetTeam() == -1 ||
|
||||||
|| GameServer()->m_apPlayers[SnappingClient]->IsPaused())
|
GameServer()->m_apPlayers[SnappingClient]->IsPaused()) &&
|
||||||
&& GameServer()->m_apPlayers[SnappingClient]->m_SpectatorID != SPEC_FREEVIEW)
|
GameServer()->m_apPlayers[SnappingClient]->m_SpectatorID != SPEC_FREEVIEW)
|
||||||
Char = GameServer()->GetPlayerChar(GameServer()->m_apPlayers[SnappingClient]->m_SpectatorID);
|
Char = GameServer()->GetPlayerChar(GameServer()->m_apPlayers[SnappingClient]->m_SpectatorID);
|
||||||
|
|
||||||
int Tick = (Server()->Tick()%Server()->TickSpeed())%11;
|
int Tick = (Server()->Tick()%Server()->TickSpeed())%11;
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#ifndef GAME_SERVER_ENTITIES_PROJECTILE_H
|
#ifndef GAME_SERVER_ENTITIES_PROJECTILE_H
|
||||||
#define GAME_SERVER_ENTITIES_PROJECTILE_H
|
#define GAME_SERVER_ENTITIES_PROJECTILE_H
|
||||||
|
|
||||||
|
#include <game/server/entity.h>
|
||||||
|
|
||||||
class CProjectile : public CEntity
|
class CProjectile : public CEntity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "teehistorian.h"
|
#include "teehistorian.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
typedef __int32 int32_t;
|
typedef __int32 int32_t;
|
||||||
typedef unsigned __int32 uint32_t;
|
typedef unsigned __int32 uint32_t;
|
||||||
|
|
|
@ -213,8 +213,8 @@ bool CScore::LoadPlayerDataThread(IDbConnection *pSqlServer, const ISqlData *pGa
|
||||||
// get best race time
|
// get best race time
|
||||||
str_format(aBuf, sizeof(aBuf),
|
str_format(aBuf, sizeof(aBuf),
|
||||||
"SELECT Time, cp1, cp2, cp3, cp4, cp5, cp6, cp7, cp8, cp9, cp10, "
|
"SELECT Time, cp1, cp2, cp3, cp4, cp5, cp6, cp7, cp8, cp9, cp10, "
|
||||||
"cp11, cp12, cp13, cp14, cp15, cp16, cp17, cp18, cp19, cp20, "
|
" cp11, cp12, cp13, cp14, cp15, cp16, cp17, cp18, cp19, cp20, "
|
||||||
"cp21, cp22, cp23, cp24, cp25 "
|
" cp21, cp22, cp23, cp24, cp25 "
|
||||||
"FROM %s_race "
|
"FROM %s_race "
|
||||||
"WHERE Map = ? AND Name = ? "
|
"WHERE Map = ? AND Name = ? "
|
||||||
"ORDER BY Time ASC "
|
"ORDER BY Time ASC "
|
||||||
|
@ -293,9 +293,9 @@ bool CScore::MapVoteThread(IDbConnection *pSqlServer, const ISqlData *pGameData)
|
||||||
"FROM %s_maps "
|
"FROM %s_maps "
|
||||||
"WHERE Map LIKE %s "
|
"WHERE Map LIKE %s "
|
||||||
"ORDER BY "
|
"ORDER BY "
|
||||||
"CASE WHEN Map = ? THEN 0 ELSE 1 END, "
|
" CASE WHEN Map = ? THEN 0 ELSE 1 END, "
|
||||||
"CASE WHEN Map LIKE ? THEN 0 ELSE 1 END, "
|
" CASE WHEN Map LIKE ? THEN 0 ELSE 1 END, "
|
||||||
"LENGTH(Map), Map "
|
" LENGTH(Map), Map "
|
||||||
"LIMIT 1;",
|
"LIMIT 1;",
|
||||||
pSqlServer->GetPrefix(), pSqlServer->CollateNocase());
|
pSqlServer->GetPrefix(), pSqlServer->CollateNocase());
|
||||||
pSqlServer->PrepareStatement(aBuf);
|
pSqlServer->PrepareStatement(aBuf);
|
||||||
|
@ -354,21 +354,21 @@ bool CScore::MapInfoThread(IDbConnection *pSqlServer, const ISqlData *pGameData)
|
||||||
char aBuf[1024];
|
char aBuf[1024];
|
||||||
str_format(aBuf, sizeof(aBuf),
|
str_format(aBuf, sizeof(aBuf),
|
||||||
"SELECT l.Map, l.Server, Mapper, Points, Stars, "
|
"SELECT l.Map, l.Server, Mapper, Points, Stars, "
|
||||||
"(SELECT COUNT(Name) FROM %s_race WHERE Map = l.Map) AS Finishes, "
|
" (SELECT COUNT(Name) FROM %s_race WHERE Map = l.Map) AS Finishes, "
|
||||||
"(SELECT COUNT(DISTINCT Name) FROM %s_race WHERE Map = l.Map) AS Finishers, "
|
" (SELECT COUNT(DISTINCT Name) FROM %s_race WHERE Map = l.Map) AS Finishers, "
|
||||||
"(SELECT ROUND(AVG(Time)) FROM %s_race WHERE Map = l.Map) AS Average, "
|
" (SELECT ROUND(AVG(Time)) FROM %s_race WHERE Map = l.Map) AS Average, "
|
||||||
"%s AS Stamp, "
|
" %s AS Stamp, "
|
||||||
"%s-%s AS Ago, "
|
" %s-%s AS Ago, "
|
||||||
"(SELECT MIN(Time) FROM %s_race WHERE Map = l.Map AND Name = ?) AS OwnTime "
|
" (SELECT MIN(Time) FROM %s_race WHERE Map = l.Map AND Name = ?) AS OwnTime "
|
||||||
"FROM ("
|
"FROM ("
|
||||||
"SELECT * FROM %s_maps "
|
" SELECT * FROM %s_maps "
|
||||||
"WHERE Map LIKE %s "
|
" WHERE Map LIKE %s "
|
||||||
"ORDER BY "
|
" ORDER BY "
|
||||||
"CASE WHEN Map = ? THEN 0 ELSE 1 END, "
|
" CASE WHEN Map = ? THEN 0 ELSE 1 END, "
|
||||||
"CASE WHEN Map LIKE ? THEN 0 ELSE 1 END, "
|
" CASE WHEN Map LIKE ? THEN 0 ELSE 1 END, "
|
||||||
"LENGTH(Map), "
|
" LENGTH(Map), "
|
||||||
"Map "
|
" Map "
|
||||||
"LIMIT 1"
|
" LIMIT 1"
|
||||||
") as l;",
|
") as l;",
|
||||||
pSqlServer->GetPrefix(), pSqlServer->GetPrefix(), pSqlServer->GetPrefix(),
|
pSqlServer->GetPrefix(), pSqlServer->GetPrefix(), pSqlServer->GetPrefix(),
|
||||||
aTimestamp, aCurrentTimestamp, aTimestamp,
|
aTimestamp, aCurrentTimestamp, aTimestamp,
|
||||||
|
@ -579,9 +579,9 @@ bool CScore::SaveTeamScoreThread(IDbConnection *pSqlServer, const ISqlData *pGam
|
||||||
str_format(aBuf, sizeof(aBuf),
|
str_format(aBuf, sizeof(aBuf),
|
||||||
"SELECT l.ID, Name, Time "
|
"SELECT l.ID, Name, Time "
|
||||||
"FROM (" // preselect teams with first name in team
|
"FROM (" // preselect teams with first name in team
|
||||||
"SELECT ID "
|
" SELECT ID "
|
||||||
"FROM %s_teamrace "
|
" FROM %s_teamrace "
|
||||||
"WHERE Map = ? AND Name = ? AND DDNet7 = false"
|
" WHERE Map = ? AND Name = ? AND DDNet7 = false"
|
||||||
") as l INNER JOIN %s_teamrace AS r ON l.ID = r.ID "
|
") as l INNER JOIN %s_teamrace AS r ON l.ID = r.ID "
|
||||||
"ORDER BY l.ID, Name COLLATE %s;",
|
"ORDER BY l.ID, Name COLLATE %s;",
|
||||||
pSqlServer->GetPrefix(), pSqlServer->GetPrefix(), pSqlServer->BinaryCollate());
|
pSqlServer->GetPrefix(), pSqlServer->GetPrefix(), pSqlServer->BinaryCollate());
|
||||||
|
@ -663,11 +663,11 @@ bool CScore::ShowRankThread(IDbConnection *pSqlServer, const ISqlData *pGameData
|
||||||
str_format(aBuf, sizeof(aBuf),
|
str_format(aBuf, sizeof(aBuf),
|
||||||
"SELECT Rank, Name, Time "
|
"SELECT Rank, Name, Time "
|
||||||
"FROM ("
|
"FROM ("
|
||||||
"SELECT RANK() OVER w AS Rank, Name, MIN(Time) AS Time "
|
" SELECT RANK() OVER w AS Rank, Name, MIN(Time) AS Time "
|
||||||
"FROM %s_race "
|
" FROM %s_race "
|
||||||
"WHERE Map = ? "
|
" WHERE Map = ? "
|
||||||
"GROUP BY Name "
|
" GROUP BY Name "
|
||||||
"WINDOW w AS (ORDER BY Time)"
|
" WINDOW w AS (ORDER BY Time)"
|
||||||
") as a "
|
") as a "
|
||||||
"WHERE Name = ?;",
|
"WHERE Name = ?;",
|
||||||
pSqlServer->GetPrefix());
|
pSqlServer->GetPrefix());
|
||||||
|
@ -721,17 +721,17 @@ bool CScore::ShowTeamRankThread(IDbConnection *pSqlServer, const ISqlData *pGame
|
||||||
str_format(aBuf, sizeof(aBuf),
|
str_format(aBuf, sizeof(aBuf),
|
||||||
"SELECT l.ID, Name, Time, Rank "
|
"SELECT l.ID, Name, Time, Rank "
|
||||||
"FROM (" // teamrank score board
|
"FROM (" // teamrank score board
|
||||||
"SELECT RANK() OVER w AS Rank, ID "
|
" SELECT RANK() OVER w AS Rank, ID "
|
||||||
"FROM %s_teamrace "
|
" FROM %s_teamrace "
|
||||||
"WHERE Map = ? "
|
" WHERE Map = ? "
|
||||||
"GROUP BY ID "
|
" GROUP BY ID "
|
||||||
"WINDOW w AS (ORDER BY Time)"
|
" WINDOW w AS (ORDER BY Time)"
|
||||||
") AS TeamRank INNER JOIN (" // select rank with Name in team
|
") AS TeamRank INNER JOIN (" // select rank with Name in team
|
||||||
"SELECT ID "
|
" SELECT ID "
|
||||||
"FROM %s_teamrace "
|
" FROM %s_teamrace "
|
||||||
"WHERE Map = ? AND Name = ? "
|
" WHERE Map = ? AND Name = ? "
|
||||||
"ORDER BY Time "
|
" ORDER BY Time "
|
||||||
"LIMIT 1"
|
" LIMIT 1"
|
||||||
") AS l ON TeamRank.ID = l.ID "
|
") AS l ON TeamRank.ID = l.ID "
|
||||||
"INNER JOIN %s_teamrace AS r ON l.ID = r.ID ",
|
"INNER JOIN %s_teamrace AS r ON l.ID = r.ID ",
|
||||||
pSqlServer->GetPrefix(), pSqlServer->GetPrefix(), pSqlServer->GetPrefix());
|
pSqlServer->GetPrefix(), pSqlServer->GetPrefix(), pSqlServer->GetPrefix());
|
||||||
|
@ -799,11 +799,11 @@ bool CScore::ShowTop5Thread(IDbConnection *pSqlServer, const ISqlData *pGameData
|
||||||
str_format(aBuf, sizeof(aBuf),
|
str_format(aBuf, sizeof(aBuf),
|
||||||
"SELECT Name, Time, Rank "
|
"SELECT Name, Time, Rank "
|
||||||
"FROM ("
|
"FROM ("
|
||||||
"SELECT RANK() OVER w AS Rank, Name, MIN(Time) AS Time "
|
" SELECT RANK() OVER w AS Rank, Name, MIN(Time) AS Time "
|
||||||
"FROM %s_race "
|
" FROM %s_race "
|
||||||
"WHERE Map = ? "
|
" WHERE Map = ? "
|
||||||
"GROUP BY Name "
|
" GROUP BY Name "
|
||||||
"WINDOW w AS (ORDER BY Time)"
|
" WINDOW w AS (ORDER BY Time)"
|
||||||
") as a "
|
") as a "
|
||||||
"ORDER BY Rank %s "
|
"ORDER BY Rank %s "
|
||||||
"LIMIT %d, 5;",
|
"LIMIT %d, 5;",
|
||||||
|
@ -856,16 +856,16 @@ bool CScore::ShowTeamTop5Thread(IDbConnection *pSqlServer, const ISqlData *pGame
|
||||||
str_format(aBuf, sizeof(aBuf),
|
str_format(aBuf, sizeof(aBuf),
|
||||||
"SELECT Name, Time, Rank, TeamSize "
|
"SELECT Name, Time, Rank, TeamSize "
|
||||||
"FROM (" // limit to 5
|
"FROM (" // limit to 5
|
||||||
"SELECT TeamSize, Rank, ID "
|
" SELECT TeamSize, Rank, ID "
|
||||||
"FROM (" // teamrank score board
|
" FROM (" // teamrank score board
|
||||||
"SELECT RANK() OVER w AS Rank, ID, COUNT(*) AS Teamsize "
|
" SELECT RANK() OVER w AS Rank, ID, COUNT(*) AS Teamsize "
|
||||||
"FROM %s_teamrace "
|
" FROM %s_teamrace "
|
||||||
"WHERE Map = ? "
|
" WHERE Map = ? "
|
||||||
"GROUP BY Id "
|
" GROUP BY Id "
|
||||||
"WINDOW w AS (ORDER BY Time)"
|
" WINDOW w AS (ORDER BY Time)"
|
||||||
") as l1 "
|
" ) as l1 "
|
||||||
"ORDER BY Rank %s "
|
" ORDER BY Rank %s "
|
||||||
"LIMIT %d, 5"
|
" LIMIT %d, 5"
|
||||||
") as l2 "
|
") as l2 "
|
||||||
"INNER JOIN %s_teamrace as r ON l2.ID = r.ID "
|
"INNER JOIN %s_teamrace as r ON l2.ID = r.ID "
|
||||||
"ORDER BY Rank %s, r.ID, Name ASC;",
|
"ORDER BY Rank %s, r.ID, Name ASC;",
|
||||||
|
@ -1045,8 +1045,8 @@ bool CScore::ShowPointsThread(IDbConnection *pSqlServer, const ISqlData *pGameDa
|
||||||
char aBuf[512];
|
char aBuf[512];
|
||||||
str_format(aBuf, sizeof(aBuf),
|
str_format(aBuf, sizeof(aBuf),
|
||||||
"SELECT ("
|
"SELECT ("
|
||||||
"SELECT COUNT(Name) + 1 FROM %s_points WHERE Points > ("
|
" SELECT COUNT(Name) + 1 FROM %s_points WHERE Points > ("
|
||||||
"SELECT points FROM %s_points WHERE Name = ?"
|
" SELECT points FROM %s_points WHERE Name = ?"
|
||||||
")) as Rank, Points, Name "
|
")) as Rank, Points, Name "
|
||||||
"FROM %s_points WHERE Name = ?;",
|
"FROM %s_points WHERE Name = ?;",
|
||||||
pSqlServer->GetPrefix(), pSqlServer->GetPrefix(), pSqlServer->GetPrefix());
|
pSqlServer->GetPrefix(), pSqlServer->GetPrefix(), pSqlServer->GetPrefix());
|
||||||
|
@ -1094,9 +1094,9 @@ bool CScore::ShowTopPointsThread(IDbConnection *pSqlServer, const ISqlData *pGam
|
||||||
str_format(aBuf, sizeof(aBuf),
|
str_format(aBuf, sizeof(aBuf),
|
||||||
"SELECT Rank, Points, Name "
|
"SELECT Rank, Points, Name "
|
||||||
"FROM ("
|
"FROM ("
|
||||||
"SELECT RANK() OVER w AS Rank, Points, Name "
|
" SELECT RANK() OVER w AS Rank, Points, Name "
|
||||||
"FROM %s_points "
|
" FROM %s_points "
|
||||||
"WINDOW w as (ORDER BY Points DESC)"
|
" WINDOW w as (ORDER BY Points DESC)"
|
||||||
") as a "
|
") as a "
|
||||||
"ORDER BY Rank %s "
|
"ORDER BY Rank %s "
|
||||||
"LIMIT ?, 5;",
|
"LIMIT ?, 5;",
|
||||||
|
@ -1203,9 +1203,9 @@ bool CScore::RandomUnfinishedMapThread(IDbConnection *pSqlServer, const ISqlData
|
||||||
"SELECT Map "
|
"SELECT Map "
|
||||||
"FROM %s_maps "
|
"FROM %s_maps "
|
||||||
"WHERE Server = ? AND Map != ? AND Stars = ? AND Map NOT IN ("
|
"WHERE Server = ? AND Map != ? AND Stars = ? AND Map NOT IN ("
|
||||||
"SELECT Map "
|
" SELECT Map "
|
||||||
"FROM %s_race "
|
" FROM %s_race "
|
||||||
"WHERE Name = ?"
|
" WHERE Name = ?"
|
||||||
") ORDER BY RAND() "
|
") ORDER BY RAND() "
|
||||||
"LIMIT 1;",
|
"LIMIT 1;",
|
||||||
pSqlServer->GetPrefix(), pSqlServer->GetPrefix());
|
pSqlServer->GetPrefix(), pSqlServer->GetPrefix());
|
||||||
|
@ -1221,9 +1221,9 @@ bool CScore::RandomUnfinishedMapThread(IDbConnection *pSqlServer, const ISqlData
|
||||||
"SELECT Map "
|
"SELECT Map "
|
||||||
"FROM %s_maps AS maps "
|
"FROM %s_maps AS maps "
|
||||||
"WHERE Server = ? AND Map != ? AND Map NOT IN ("
|
"WHERE Server = ? AND Map != ? AND Map NOT IN ("
|
||||||
"SELECT Map "
|
" SELECT Map "
|
||||||
"FROM %s_race as race "
|
" FROM %s_race as race "
|
||||||
"WHERE Name = ?"
|
" WHERE Name = ?"
|
||||||
") ORDER BY RAND() "
|
") ORDER BY RAND() "
|
||||||
"LIMIT 1;",
|
"LIMIT 1;",
|
||||||
pSqlServer->GetPrefix(), pSqlServer->GetPrefix());
|
pSqlServer->GetPrefix(), pSqlServer->GetPrefix());
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#include "teehistorian.h"
|
#include "teehistorian.h"
|
||||||
|
|
||||||
#include <engine/shared/config.h>
|
#include <engine/shared/config.h>
|
||||||
#include <engine/shared/snapshot.h>
|
|
||||||
#include <engine/shared/json.h>
|
#include <engine/shared/json.h>
|
||||||
|
#include <engine/shared/snapshot.h>
|
||||||
#include <game/gamecore.h>
|
#include <game/gamecore.h>
|
||||||
|
|
||||||
static const char TEEHISTORIAN_NAME[] = "teehistorian@ddnet.tw";
|
static const char TEEHISTORIAN_NAME[] = "teehistorian@ddnet.tw";
|
||||||
static const CUuid TEEHISTORIAN_UUID = CalculateUuid(TEEHISTORIAN_NAME);
|
static const CUuid TEEHISTORIAN_UUID = CalculateUuid(TEEHISTORIAN_NAME);
|
||||||
static const char TEEHISTORIAN_VERSION[] = "2";
|
static const char TEEHISTORIAN_VERSION[] = "2";
|
||||||
|
|
||||||
#define UUID(id, name) static const CUuid UUID_ ## id = CalculateUuid(name);
|
#define UUID(id, name) static const CUuid UUID_##id = CalculateUuid(name);
|
||||||
#include <engine/shared/teehistorian_ex_chunks.h>
|
#include <engine/shared/teehistorian_ex_chunks.h>
|
||||||
#undef UUID
|
#undef UUID
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ void CTeeHistorian::WriteHeader(const CGameInfo *pGameInfo)
|
||||||
|
|
||||||
char aJson[2048];
|
char aJson[2048];
|
||||||
|
|
||||||
#define E(buf, str) EscapeJson(buf, sizeof(buf), str)
|
#define E(buf, str) EscapeJson(buf, sizeof(buf), str)
|
||||||
|
|
||||||
str_format(aJson, sizeof(aJson), "{\"comment\":\"%s\",\"version\":\"%s\",\"game_uuid\":\"%s\",\"server_version\":\"%s\",\"start_time\":\"%s\",\"server_name\":\"%s\",\"server_port\":\"%d\",\"game_type\":\"%s\",\"map_name\":\"%s\",\"map_size\":\"%d\",\"map_sha256\":\"%s\",\"map_crc\":\"%08x\",\"prng_description\":\"%s\",\"config\":{",
|
str_format(aJson, sizeof(aJson), "{\"comment\":\"%s\",\"version\":\"%s\",\"game_uuid\":\"%s\",\"server_version\":\"%s\",\"start_time\":\"%s\",\"server_name\":\"%s\",\"server_port\":\"%d\",\"game_type\":\"%s\",\"map_name\":\"%s\",\"map_size\":\"%d\",\"map_sha256\":\"%s\",\"map_crc\":\"%08x\",\"prng_description\":\"%s\",\"config\":{",
|
||||||
E(aCommentBuffer, TEEHISTORIAN_NAME),
|
E(aCommentBuffer, TEEHISTORIAN_NAME),
|
||||||
|
@ -106,7 +106,7 @@ void CTeeHistorian::WriteHeader(const CGameInfo *pGameInfo)
|
||||||
char aBuffer2[1024];
|
char aBuffer2[1024];
|
||||||
bool First = true;
|
bool First = true;
|
||||||
|
|
||||||
#define MACRO_CONFIG_INT(Name,ScriptName,Def,Min,Max,Flags,Desc) \
|
#define MACRO_CONFIG_INT(Name, ScriptName, Def, Min, Max, Flags, Desc) \
|
||||||
if((Flags)&CFGFLAG_SERVER && !((Flags)&CFGFLAG_NONTEEHISTORIC) && pGameInfo->m_pConfig->m_##Name != (Def)) \
|
if((Flags)&CFGFLAG_SERVER && !((Flags)&CFGFLAG_NONTEEHISTORIC) && pGameInfo->m_pConfig->m_##Name != (Def)) \
|
||||||
{ \
|
{ \
|
||||||
str_format(aJson, sizeof(aJson), "%s\"%s\":\"%d\"", \
|
str_format(aJson, sizeof(aJson), "%s\"%s\":\"%d\"", \
|
||||||
|
@ -117,9 +117,9 @@ void CTeeHistorian::WriteHeader(const CGameInfo *pGameInfo)
|
||||||
First = false; \
|
First = false; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MACRO_CONFIG_COL(Name,ScriptName,Def,Save,Desc) MACRO_CONFIG_INT(Name,ScriptName,Def,0,0,Save,Desc)
|
#define MACRO_CONFIG_COL(Name, ScriptName, Def, Save, Desc) MACRO_CONFIG_INT(Name, ScriptName, Def, 0, 0, Save, Desc)
|
||||||
|
|
||||||
#define MACRO_CONFIG_STR(Name,ScriptName,Len,Def,Flags,Desc) \
|
#define MACRO_CONFIG_STR(Name, ScriptName, Len, Def, Flags, Desc) \
|
||||||
if((Flags)&CFGFLAG_SERVER && !((Flags)&CFGFLAG_NONTEEHISTORIC) && str_comp(pGameInfo->m_pConfig->m_##Name, (Def)) != 0) \
|
if((Flags)&CFGFLAG_SERVER && !((Flags)&CFGFLAG_NONTEEHISTORIC) && str_comp(pGameInfo->m_pConfig->m_##Name, (Def)) != 0) \
|
||||||
{ \
|
{ \
|
||||||
str_format(aJson, sizeof(aJson), "%s\"%s\":\"%s\"", \
|
str_format(aJson, sizeof(aJson), "%s\"%s\":\"%s\"", \
|
||||||
|
@ -130,11 +130,11 @@ void CTeeHistorian::WriteHeader(const CGameInfo *pGameInfo)
|
||||||
First = false; \
|
First = false; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <engine/shared/config_variables.h>
|
#include <engine/shared/config_variables.h>
|
||||||
|
|
||||||
#undef MACRO_CONFIG_INT
|
#undef MACRO_CONFIG_INT
|
||||||
#undef MACRO_CONFIG_COL
|
#undef MACRO_CONFIG_COL
|
||||||
#undef MACRO_CONFIG_STR
|
#undef MACRO_CONFIG_STR
|
||||||
|
|
||||||
str_format(aJson, sizeof(aJson), "},\"tuning\":{");
|
str_format(aJson, sizeof(aJson), "},\"tuning\":{");
|
||||||
Write(aJson, str_length(aJson));
|
Write(aJson, str_length(aJson));
|
||||||
|
@ -142,7 +142,7 @@ void CTeeHistorian::WriteHeader(const CGameInfo *pGameInfo)
|
||||||
First = true;
|
First = true;
|
||||||
|
|
||||||
static const float TicksPerSecond = 50.0f;
|
static const float TicksPerSecond = 50.0f;
|
||||||
#define MACRO_TUNING_PARAM(Name,ScriptName,Value,Description) \
|
#define MACRO_TUNING_PARAM(Name, ScriptName, Value, Description) \
|
||||||
if(pGameInfo->m_pTuning->m_##Name.Get() != (int)((Value)*100)) \
|
if(pGameInfo->m_pTuning->m_##Name.Get() != (int)((Value)*100)) \
|
||||||
{ \
|
{ \
|
||||||
str_format(aJson, sizeof(aJson), "%s\"%s\":\"%d\"", \
|
str_format(aJson, sizeof(aJson), "%s\"%s\":\"%d\"", \
|
||||||
|
@ -152,8 +152,8 @@ void CTeeHistorian::WriteHeader(const CGameInfo *pGameInfo)
|
||||||
Write(aJson, str_length(aJson)); \
|
Write(aJson, str_length(aJson)); \
|
||||||
First = false; \
|
First = false; \
|
||||||
}
|
}
|
||||||
#include <game/tuning.h>
|
#include <game/tuning.h>
|
||||||
#undef MACRO_TUNING_PARAM
|
#undef MACRO_TUNING_PARAM
|
||||||
|
|
||||||
str_format(aJson, sizeof(aJson), "},\"uuids\":[");
|
str_format(aJson, sizeof(aJson), "},\"uuids\":[");
|
||||||
Write(aJson, str_length(aJson));
|
Write(aJson, str_length(aJson));
|
||||||
|
@ -184,7 +184,6 @@ void CTeeHistorian::WriteExtra(CUuid Uuid, const void *pData, int DataSize)
|
||||||
Write(pData, DataSize);
|
Write(pData, DataSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CTeeHistorian::BeginTick(int Tick)
|
void CTeeHistorian::BeginTick(int Tick)
|
||||||
{
|
{
|
||||||
dbg_assert(m_State == STATE_START || m_State == STATE_BEFORE_TICK, "invalid teehistorian state");
|
dbg_assert(m_State == STATE_START || m_State == STATE_BEFORE_TICK, "invalid teehistorian state");
|
||||||
|
|
|
@ -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, 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));
|
mem_zero(&m_GameInfo, sizeof(m_GameInfo));
|
||||||
|
|
||||||
|
@ -349,8 +348,7 @@ TEST_F(TeeHistorian, DDNetVersion)
|
||||||
};
|
};
|
||||||
CUuid ConnectionID = {
|
CUuid ConnectionID = {
|
||||||
0xfb, 0x13, 0xa5, 0x76, 0xd3, 0x5f, 0x48, 0x93,
|
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.RecordDDNetVersion(0, ConnectionID, 13010, "DDNet 13.1 (3623f5e4cd184556)");
|
||||||
m_TH.RecordDDNetVersionOld(1, 13010);
|
m_TH.RecordDDNetVersionOld(1, 13010);
|
||||||
Finish();
|
Finish();
|
||||||
|
@ -456,8 +454,7 @@ TEST_F(TeeHistorian, SaveSuccess)
|
||||||
|
|
||||||
CUuid SaveID = {
|
CUuid SaveID = {
|
||||||
0xfb, 0x13, 0xa5, 0x76, 0xd3, 0x5f, 0x48, 0x93,
|
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";
|
const char *pTeamSave = "2\tH.\nll0";
|
||||||
m_TH.RecordTeamSaveSuccess(21, SaveID, pTeamSave);
|
m_TH.RecordTeamSaveSuccess(21, SaveID, pTeamSave);
|
||||||
Finish();
|
Finish();
|
||||||
|
@ -503,8 +500,7 @@ TEST_F(TeeHistorian, LoadSuccess)
|
||||||
|
|
||||||
CUuid SaveID = {
|
CUuid SaveID = {
|
||||||
0xfb, 0x13, 0xa5, 0x76, 0xd3, 0x5f, 0x48, 0x93,
|
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";
|
const char *pTeamSave = "2\tH.\nll0";
|
||||||
m_TH.RecordTeamLoadSuccess(21, SaveID, pTeamSave);
|
m_TH.RecordTeamLoadSuccess(21, SaveID, pTeamSave);
|
||||||
Finish();
|
Finish();
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct CPingConfig
|
||||||
};
|
};
|
||||||
|
|
||||||
static CPingConfig m_aConfigPings[] = {
|
static CPingConfig m_aConfigPings[] = {
|
||||||
// base flux spike loss delay delayfreq
|
// base flux spike loss delay delayfreq
|
||||||
{0, 0, 0, 0, 0, 0},
|
{0, 0, 0, 0, 0, 0},
|
||||||
{40, 20, 100, 0, 0, 0},
|
{40, 20, 100, 0, 0, 0},
|
||||||
{140, 40, 200, 0, 0, 0},
|
{140, 40, 200, 0, 0, 0},
|
||||||
|
|
Loading…
Reference in a new issue