Merge pull request #7618 from heinrich5991/pr_ddnet_less_system_h

Make less headers depend on `<base/system.h>`
This commit is contained in:
Dennis Felsing 2023-12-11 23:08:59 +00:00 committed by GitHub
commit 7813cfed6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 152 additions and 108 deletions

View file

@ -2157,6 +2157,7 @@ if(CLIENT)
updater.h updater.h
video.cpp video.cpp
video.h video.h
warning.cpp
) )
set_src(GAME_CLIENT GLOB_RECURSE src/game/client set_src(GAME_CLIENT GLOB_RECURSE src/game/client
animstate.cpp animstate.cpp

View file

@ -51,6 +51,7 @@ Authed = ["NO", "HELPER", "MOD", "ADMIN"]
EntityClasses = ["PROJECTILE", "DOOR", "DRAGGER_WEAK", "DRAGGER_NORMAL", "DRAGGER_STRONG", "GUN_NORMAL", "GUN_EXPLOSIVE", "GUN_FREEZE", "GUN_UNFREEZE", "LIGHT", "PICKUP"] EntityClasses = ["PROJECTILE", "DOOR", "DRAGGER_WEAK", "DRAGGER_NORMAL", "DRAGGER_STRONG", "GUN_NORMAL", "GUN_EXPLOSIVE", "GUN_FREEZE", "GUN_UNFREEZE", "LIGHT", "PICKUP"]
RawHeader = ''' RawHeader = '''
#include <base/system.h>
#include <engine/shared/teehistorian_ex.h> #include <engine/shared/teehistorian_ex.h>
enum enum

View file

@ -1,7 +1,6 @@
#ifndef ANTIBOT_ANTIBOT_DATA_H #ifndef ANTIBOT_ANTIBOT_DATA_H
#define ANTIBOT_ANTIBOT_DATA_H #define ANTIBOT_ANTIBOT_DATA_H
#include <base/system.h>
#include <base/vmath.h> #include <base/vmath.h>
enum enum

View file

@ -2,7 +2,6 @@
#define BASE_HASH_CTXT_H #define BASE_HASH_CTXT_H
#include "hash.h" #include "hash.h"
#include "system.h"
#include <cstdint> #include <cstdint>
#if defined(CONF_OPENSSL) #if defined(CONF_OPENSSL)

View file

@ -9,6 +9,7 @@
#define BASE_SYSTEM_H #define BASE_SYSTEM_H
#include "detect.h" #include "detect.h"
#include "types.h"
#ifndef __USE_GNU #ifndef __USE_GNU
#define __USE_GNU #define __USE_GNU
@ -226,12 +227,8 @@ enum
IOSEEK_START = 0, IOSEEK_START = 0,
IOSEEK_CUR = 1, IOSEEK_CUR = 1,
IOSEEK_END = 2, IOSEEK_END = 2,
IO_MAX_PATH_LENGTH = 512,
}; };
typedef void *IOHANDLE;
/** /**
* Opens a file. * Opens a file.
* *
@ -741,44 +738,12 @@ ETimeSeason time_season();
* @defgroup Network-General * @defgroup Network-General
*/ */
/**
* @ingroup Network-General
*/
typedef struct NETSOCKET_INTERNAL *NETSOCKET;
/**
* @ingroup Network-General
*/
enum
{
NETADDR_MAXSTRSIZE = 1 + (8 * 4 + 7) + 1 + 1 + 5 + 1, // [XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX]:XXXXX
NETTYPE_LINK_BROADCAST = 4,
NETTYPE_INVALID = 0,
NETTYPE_IPV4 = 1,
NETTYPE_IPV6 = 2,
NETTYPE_WEBSOCKET_IPV4 = 8,
NETTYPE_ALL = NETTYPE_IPV4 | NETTYPE_IPV6 | NETTYPE_WEBSOCKET_IPV4,
NETTYPE_MASK = NETTYPE_ALL | NETTYPE_LINK_BROADCAST,
};
/**
* @ingroup Network-General
*/
typedef struct NETADDR
{
unsigned int type;
unsigned char ip[16];
unsigned short port;
bool operator==(const NETADDR &other) const;
bool operator!=(const NETADDR &other) const { return !(*this == other); }
} NETADDR;
extern const NETADDR NETADDR_ZEROED; extern const NETADDR NETADDR_ZEROED;
/**
* @ingroup Network-General
*/
#ifdef CONF_FAMILY_UNIX #ifdef CONF_FAMILY_UNIX
/** /**
* @ingroup Network-General * @ingroup Network-General
@ -1810,16 +1775,8 @@ void str_escape(char **dst, const char *src, const char *end);
* *
* @remark The strings are treated as zero-terminated strings. * @remark The strings are treated as zero-terminated strings.
*/ */
typedef int (*FS_LISTDIR_CALLBACK)(const char *name, int is_dir, int dir_type, void *user);
void fs_listdir(const char *dir, FS_LISTDIR_CALLBACK cb, int type, void *user); void fs_listdir(const char *dir, FS_LISTDIR_CALLBACK cb, int type, void *user);
typedef struct
{
const char *m_pName;
time_t m_TimeCreated; // seconds since UNIX Epoch
time_t m_TimeModified; // seconds since UNIX Epoch
} CFsFileInfo;
/** /**
* Lists the files and folders in a directory and gets additional file information. * Lists the files and folders in a directory and gets additional file information.
* *
@ -1832,7 +1789,6 @@ typedef struct
* *
* @remark The strings are treated as zero-terminated strings. * @remark The strings are treated as zero-terminated strings.
*/ */
typedef int (*FS_LISTDIR_CALLBACK_FILEINFO)(const CFsFileInfo *info, int is_dir, int dir_type, void *user);
void fs_listdir_fileinfo(const char *dir, FS_LISTDIR_CALLBACK_FILEINFO cb, int type, void *user); void fs_listdir_fileinfo(const char *dir, FS_LISTDIR_CALLBACK_FILEINFO cb, int type, void *user);
/** /**
@ -2183,14 +2139,6 @@ int str_isallnum_hex(const char *str);
unsigned str_quickhash(const char *str); unsigned str_quickhash(const char *str);
enum
{
/**
* The maximum bytes necessary to encode one Unicode codepoint with UTF-8.
*/
UTF8_BYTE_LENGTH = 4,
};
int str_utf8_to_skeleton(const char *str, int *buf, int buf_len); int str_utf8_to_skeleton(const char *str, int *buf, int buf_len);
/* /*

View file

@ -1,6 +1,8 @@
#ifndef BASE_TYPES_H #ifndef BASE_TYPES_H
#define BASE_TYPES_H #define BASE_TYPES_H
#include <ctime>
enum class TRISTATE enum class TRISTATE
{ {
NONE, NONE,
@ -8,4 +10,56 @@ enum class TRISTATE
ALL, ALL,
}; };
typedef void *IOHANDLE;
typedef int (*FS_LISTDIR_CALLBACK)(const char *name, int is_dir, int dir_type, void *user);
typedef struct
{
const char *m_pName;
time_t m_TimeCreated; // seconds since UNIX Epoch
time_t m_TimeModified; // seconds since UNIX Epoch
} CFsFileInfo;
typedef int (*FS_LISTDIR_CALLBACK_FILEINFO)(const CFsFileInfo *info, int is_dir, int dir_type, void *user);
/**
* @ingroup Network-General
*/
typedef struct NETSOCKET_INTERNAL *NETSOCKET;
enum
{
/**
* The maximum bytes necessary to encode one Unicode codepoint with UTF-8.
*/
UTF8_BYTE_LENGTH = 4,
IO_MAX_PATH_LENGTH = 512,
NETADDR_MAXSTRSIZE = 1 + (8 * 4 + 7) + 1 + 1 + 5 + 1, // [XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX]:XXXXX
NETTYPE_LINK_BROADCAST = 4,
NETTYPE_INVALID = 0,
NETTYPE_IPV4 = 1,
NETTYPE_IPV6 = 2,
NETTYPE_WEBSOCKET_IPV4 = 8,
NETTYPE_ALL = NETTYPE_IPV4 | NETTYPE_IPV6 | NETTYPE_WEBSOCKET_IPV4,
NETTYPE_MASK = NETTYPE_ALL | NETTYPE_LINK_BROADCAST,
};
/**
* @ingroup Network-General
*/
typedef struct NETADDR
{
unsigned int type;
unsigned char ip[16];
unsigned short port;
bool operator==(const NETADDR &other) const;
bool operator!=(const NETADDR &other) const { return !(*this == other); }
} NETADDR;
#endif // BASE_TYPES_H #endif // BASE_TYPES_H

View file

@ -1,4 +1,5 @@
#include "backend_base.h" #include "backend_base.h"
#include <base/system.h>
#include <engine/gfx/image_manipulation.h> #include <engine/gfx/image_manipulation.h>
void *CCommandProcessorFragment_GLBase::Resize(const unsigned char *pData, int Width, int Height, int NewWidth, int NewHeight, int BPP) void *CCommandProcessorFragment_GLBase::Resize(const unsigned char *pData, int Width, int Height, int NewWidth, int NewHeight, int BPP)

View file

@ -1,3 +1,4 @@
#include <base/system.h>
#include <engine/favorites.h> #include <engine/favorites.h>
#include <engine/shared/config.h> #include <engine/shared/config.h>
#include <engine/shared/protocol.h> #include <engine/shared/protocol.h>

View file

@ -3,6 +3,8 @@
#include <engine/ghost.h> #include <engine/ghost.h>
#include <base/system.h>
enum enum
{ {
MAX_ITEM_SIZE = 128, MAX_ITEM_SIZE = 128,

View file

@ -1,6 +1,7 @@
#ifndef ENGINE_CLIENT_GRAPHICS_THREADED_H #ifndef ENGINE_CLIENT_GRAPHICS_THREADED_H
#define ENGINE_CLIENT_GRAPHICS_THREADED_H #define ENGINE_CLIENT_GRAPHICS_THREADED_H
#include <base/system.h>
#include <engine/graphics.h> #include <engine/graphics.h>
#include <engine/shared/config.h> #include <engine/shared/config.h>

View file

@ -1,6 +1,6 @@
#ifndef ENGINE_CLIENT_SERVERBROWSER_HTTP_H #ifndef ENGINE_CLIENT_SERVERBROWSER_HTTP_H
#define ENGINE_CLIENT_SERVERBROWSER_HTTP_H #define ENGINE_CLIENT_SERVERBROWSER_HTTP_H
#include <base/system.h> #include <base/types.h>
class CServerInfo; class CServerInfo;
class IConsole; class IConsole;

View file

@ -1,5 +1,6 @@
#include "serverbrowser_ping_cache.h" #include "serverbrowser_ping_cache.h"
#include <base/system.h>
#include <engine/console.h> #include <engine/console.h>
#include <engine/sqlite.h> #include <engine/sqlite.h>

View file

@ -1,6 +1,6 @@
#ifndef ENGINE_CLIENT_SERVERBROWSER_PING_CACHE_H #ifndef ENGINE_CLIENT_SERVERBROWSER_PING_CACHE_H
#define ENGINE_CLIENT_SERVERBROWSER_PING_CACHE_H #define ENGINE_CLIENT_SERVERBROWSER_PING_CACHE_H
#include <base/system.h> #include <base/types.h>
class IConsole; class IConsole;
class IStorage; class IStorage;

View file

@ -1,5 +1,6 @@
#include <engine/steam.h> #include <engine/steam.h>
#include <base/system.h>
#include <engine/shared/config.h> #include <engine/shared/config.h>
#include <steam/steam_api_flat.h> #include <steam/steam_api_flat.h>

View file

@ -2,7 +2,6 @@
#define ENGINE_CLIENT_VIDEO_H #define ENGINE_CLIENT_VIDEO_H
#include <base/lock.h> #include <base/lock.h>
#include <base/system.h>
extern "C" { extern "C" {
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>

View file

@ -0,0 +1,14 @@
#include <engine/warning.h>
#include <base/system.h>
SWarning::SWarning(const char *pMsg)
{
str_copy(m_aWarningTitle, "");
str_copy(m_aWarningMsg, pMsg);
}
SWarning::SWarning(const char *pTitle, const char *pMsg)
{
str_copy(m_aWarningTitle, pTitle);
str_copy(m_aWarningMsg, pMsg);
}

View file

@ -8,6 +8,8 @@
#include <engine/map.h> #include <engine/map.h>
#include <engine/shared/uuid_manager.h> #include <engine/shared/uuid_manager.h>
#include <cstdint>
enum enum
{ {
MAX_TIMELINE_MARKERS = 64 MAX_TIMELINE_MARKERS = 64
@ -37,15 +39,7 @@ struct CDemoHeader
unsigned char m_aLength[sizeof(int32_t)]; unsigned char m_aLength[sizeof(int32_t)];
char m_aTimestamp[20]; char m_aTimestamp[20];
bool Valid() const bool Valid() const;
{
// Check marker and ensure that strings are zero-terminated and valid UTF-8.
return mem_comp(m_aMarker, gs_aHeaderMarker, sizeof(gs_aHeaderMarker)) == 0 &&
mem_has_null(m_aNetversion, sizeof(m_aNetversion)) && str_utf8_check(m_aNetversion) &&
mem_has_null(m_aMapName, sizeof(m_aMapName)) && str_utf8_check(m_aMapName) &&
mem_has_null(m_aType, sizeof(m_aType)) && str_utf8_check(m_aType) &&
mem_has_null(m_aTimestamp, sizeof(m_aTimestamp)) && str_utf8_check(m_aTimestamp);
}
}; };
struct CTimelineMarkers struct CTimelineMarkers

View file

@ -2,6 +2,7 @@
#define ENGINE_DISCORD_H #define ENGINE_DISCORD_H
#include "kernel.h" #include "kernel.h"
#include <base/types.h>
class IDiscord : public IInterface class IDiscord : public IInterface
{ {

View file

@ -7,6 +7,7 @@
#include "warning.h" #include "warning.h"
#include <base/color.h> #include <base/color.h>
#include <base/system.h>
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>

View file

@ -4,6 +4,7 @@
#define ENGINE_INPUT_H #define ENGINE_INPUT_H
#include "kernel.h" #include "kernel.h"
#include <base/system.h>
const int g_MaxKeys = 512; const int g_MaxKeys = 512;
extern const char g_aaKeyStrings[g_MaxKeys][20]; extern const char g_aaKeyStrings[g_MaxKeys][20];

View file

@ -3,8 +3,6 @@
#ifndef ENGINE_KERNEL_H #ifndef ENGINE_KERNEL_H
#define ENGINE_KERNEL_H #define ENGINE_KERNEL_H
#include <base/system.h>
class IKernel; class IKernel;
class IInterface; class IInterface;

View file

@ -5,6 +5,7 @@
#include "kernel.h" #include "kernel.h"
#include <base/hash.h> #include <base/hash.h>
#include <base/types.h>
enum enum
{ {

View file

@ -2,6 +2,11 @@
#include <engine/shared/protocol.h> #include <engine/shared/protocol.h>
IDbConnection::IDbConnection(const char *pPrefix)
{
str_copy(m_aPrefix, pPrefix);
}
void IDbConnection::FormatCreateRace(char *aBuf, unsigned int BufferSize, bool Backup) void IDbConnection::FormatCreateRace(char *aBuf, unsigned int BufferSize, bool Backup)
{ {
str_format(aBuf, BufferSize, str_format(aBuf, BufferSize,

View file

@ -2,7 +2,6 @@
#define ENGINE_SERVER_DATABASES_CONNECTION_H #define ENGINE_SERVER_DATABASES_CONNECTION_H
#include "connection_pool.h" #include "connection_pool.h"
#include <base/system.h>
#include <memory> #include <memory>
@ -12,10 +11,7 @@ class IConsole;
class IDbConnection class IDbConnection
{ {
public: public:
IDbConnection(const char *pPrefix) IDbConnection(const char *pPrefix);
{
str_copy(m_aPrefix, pPrefix);
}
virtual ~IDbConnection() {} virtual ~IDbConnection() {}
IDbConnection &operator=(const IDbConnection &) = delete; IDbConnection &operator=(const IDbConnection &) = delete;
virtual void Print(IConsole *pConsole, const char *pMode) = 0; virtual void Print(IConsole *pConsole, const char *pMode) = 0;

View file

@ -1,7 +1,7 @@
#ifndef ENGINE_SERVER_UPNP_H #ifndef ENGINE_SERVER_UPNP_H
#define ENGINE_SERVER_UPNP_H #define ENGINE_SERVER_UPNP_H
#include <base/system.h> #include <base/types.h>
class CUPnP class CUPnP
{ {
NETADDR m_Addr; NETADDR m_Addr;

View file

@ -4,7 +4,7 @@
#define ENGINE_SERVERBROWSER_H #define ENGINE_SERVERBROWSER_H
#include <base/hash.h> #include <base/hash.h>
#include <base/types.h> #include <base/system.h>
#include <engine/map.h> #include <engine/map.h>
#include <engine/shared/protocol.h> #include <engine/shared/protocol.h>

View file

@ -5,6 +5,7 @@
#include "memheap.h" #include "memheap.h"
#include <base/math.h> #include <base/math.h>
#include <base/system.h>
#include <engine/console.h> #include <engine/console.h>
#include <engine/storage.h> #include <engine/storage.h>

View file

@ -1,5 +1,7 @@
#include "csv.h" #include "csv.h"
#include <base/system.h>
void CsvWrite(IOHANDLE File, int NumColumns, const char *const *ppColumns) void CsvWrite(IOHANDLE File, int NumColumns, const char *const *ppColumns)
{ {
for(int i = 0; i < NumColumns; i++) for(int i = 0; i < NumColumns; i++)

View file

@ -1,7 +1,7 @@
#ifndef ENGINE_SHARED_CSV_H #ifndef ENGINE_SHARED_CSV_H
#define ENGINE_SHARED_CSV_H #define ENGINE_SHARED_CSV_H
#include <base/system.h> #include <base/types.h>
void CsvWrite(IOHANDLE File, int NumColumns, const char *const *ppColumns); void CsvWrite(IOHANDLE File, int NumColumns, const char *const *ppColumns);

View file

@ -6,7 +6,7 @@
#include <engine/storage.h> #include <engine/storage.h>
#include <base/hash.h> #include <base/hash.h>
#include <base/system.h> #include <base/types.h>
#include <array> #include <array>
#include <vector> #include <vector>

View file

@ -31,6 +31,16 @@ static const int gs_NumMarkersOffset = 176;
static const ColorRGBA gs_DemoPrintColor{0.75f, 0.7f, 0.7f, 1.0f}; static const ColorRGBA gs_DemoPrintColor{0.75f, 0.7f, 0.7f, 1.0f};
bool CDemoHeader::Valid() const
{
// Check marker and ensure that strings are zero-terminated and valid UTF-8.
return mem_comp(m_aMarker, gs_aHeaderMarker, sizeof(gs_aHeaderMarker)) == 0 &&
mem_has_null(m_aNetversion, sizeof(m_aNetversion)) && str_utf8_check(m_aNetversion) &&
mem_has_null(m_aMapName, sizeof(m_aMapName)) && str_utf8_check(m_aMapName) &&
mem_has_null(m_aType, sizeof(m_aType)) && str_utf8_check(m_aType) &&
mem_has_null(m_aTimestamp, sizeof(m_aTimestamp)) && str_utf8_check(m_aTimestamp);
}
CDemoRecorder::CDemoRecorder(class CSnapshotDelta *pSnapshotDelta, bool NoMapData) CDemoRecorder::CDemoRecorder(class CSnapshotDelta *pSnapshotDelta, bool NoMapData)
{ {
m_File = 0; m_File = 0;

View file

@ -1,6 +1,7 @@
#ifndef ENGINE_SHARED_FIFO_H #ifndef ENGINE_SHARED_FIFO_H
#define ENGINE_SHARED_FIFO_H #define ENGINE_SHARED_FIFO_H
#include <base/detect.h>
#include <engine/console.h> #include <engine/console.h>
class CFifo class CFifo

View file

@ -2,6 +2,7 @@
/* If you are missing that file, acquire a complete release at teeworlds.com. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
#include <base/math.h> #include <base/math.h>
#include <base/system.h>
#include <engine/storage.h> #include <engine/storage.h>

View file

@ -3,7 +3,7 @@
#ifndef ENGINE_SHARED_FILECOLLECTION_H #ifndef ENGINE_SHARED_FILECOLLECTION_H
#define ENGINE_SHARED_FILECOLLECTION_H #define ENGINE_SHARED_FILECOLLECTION_H
#include <base/system.h> #include <base/types.h>
#include <cstdint> #include <cstdint>

View file

@ -3,6 +3,8 @@
#include "jsonwriter.h" #include "jsonwriter.h"
#include <base/system.h>
static char EscapeJsonChar(char c) static char EscapeJsonChar(char c)
{ {
switch(c) switch(c)

View file

@ -3,9 +3,10 @@
#ifndef ENGINE_SHARED_JSONWRITER_H #ifndef ENGINE_SHARED_JSONWRITER_H
#define ENGINE_SHARED_JSONWRITER_H #define ENGINE_SHARED_JSONWRITER_H
#include <base/system.h> #include <base/types.h>
#include <stack> #include <stack>
#include <string>
/** /**
* JSON writer with abstract writing function. * JSON writer with abstract writing function.

View file

@ -2,6 +2,8 @@
/* If you are missing that file, acquire a complete release at teeworlds.com. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
#include "linereader.h" #include "linereader.h"
#include <base/system.h>
void CLineReader::Init(IOHANDLE File) void CLineReader::Init(IOHANDLE File)
{ {
m_BufferMaxSize = sizeof(m_aBuffer) - 1; m_BufferMaxSize = sizeof(m_aBuffer) - 1;

View file

@ -2,7 +2,7 @@
/* If you are missing that file, acquire a complete release at teeworlds.com. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef ENGINE_SHARED_LINEREADER_H #ifndef ENGINE_SHARED_LINEREADER_H
#define ENGINE_SHARED_LINEREADER_H #define ENGINE_SHARED_LINEREADER_H
#include <base/system.h> #include <base/types.h>
// buffered stream for reading lines, should perhaps be something smaller // buffered stream for reading lines, should perhaps be something smaller
class CLineReader class CLineReader

View file

@ -3,7 +3,7 @@
#ifndef ENGINE_SHARED_MAP_H #ifndef ENGINE_SHARED_MAP_H
#define ENGINE_SHARED_MAP_H #define ENGINE_SHARED_MAP_H
#include <base/system.h> #include <base/types.h>
#include "datafile.h" #include "datafile.h"
#include <engine/map.h> #include <engine/map.h>

View file

@ -1,9 +1,8 @@
#ifndef ENGINE_SHARED_NETBAN_H #ifndef ENGINE_SHARED_NETBAN_H
#define ENGINE_SHARED_NETBAN_H #define ENGINE_SHARED_NETBAN_H
#include <engine/console.h>
#include <base/system.h> #include <base/system.h>
#include <engine/console.h>
inline int NetComp(const NETADDR *pAddr1, const NETADDR *pAddr2) inline int NetComp(const NETADDR *pAddr1, const NETADDR *pAddr2)
{ {

View file

@ -3,6 +3,7 @@
#include "config.h" #include "config.h"
#include "uuid_manager.h" #include "uuid_manager.h"
#include <base/system.h>
#include <engine/message.h> #include <engine/message.h>
#include <new> #include <new>

View file

@ -2,6 +2,7 @@
#include "json.h" #include "json.h"
#include <base/math.h> #include <base/math.h>
#include <base/system.h>
#include <engine/external/json-parser/json.h> #include <engine/external/json-parser/json.h>
#include <cstdio> #include <cstdio>

View file

@ -1,6 +1,7 @@
#include "uuid_manager.h" #include "uuid_manager.h"
#include <base/hash_ctxt.h> #include <base/hash_ctxt.h>
#include <base/system.h>
#include <engine/shared/packer.h> #include <engine/shared/packer.h>
#include <algorithm> #include <algorithm>
@ -100,6 +101,11 @@ bool CUuid::operator!=(const CUuid &Other) const
return !(*this == Other); return !(*this == Other);
} }
bool CUuid::operator<(const CUuid &Other) const
{
return mem_comp(this, &Other, sizeof(*this)) < 0;
}
static int GetIndex(int ID) static int GetIndex(int ID)
{ {
return ID - OFFSET_UUID; return ID - OFFSET_UUID;

View file

@ -3,8 +3,6 @@
#include <vector> #include <vector>
#include <base/system.h>
enum enum
{ {
UUID_MAXSTRSIZE = 37, // 12345678-0123-5678-0123-567890123456 UUID_MAXSTRSIZE = 37, // 12345678-0123-5678-0123-567890123456
@ -21,7 +19,7 @@ struct CUuid
bool operator==(const CUuid &Other) const; bool operator==(const CUuid &Other) const;
bool operator!=(const CUuid &Other) const; bool operator!=(const CUuid &Other) const;
bool operator<(const CUuid &Other) const { return mem_comp(m_aData, Other.m_aData, sizeof(m_aData)) < 0; } bool operator<(const CUuid &Other) const;
}; };
extern const CUuid UUID_ZEROED; extern const CUuid UUID_ZEROED;

View file

@ -1,6 +1,8 @@
#ifndef ENGINE_STEAM_H #ifndef ENGINE_STEAM_H
#define ENGINE_STEAM_H #define ENGINE_STEAM_H
#include <base/types.h>
#include "kernel.h" #include "kernel.h"
class ISteam : public IInterface class ISteam : public IInterface

View file

@ -4,6 +4,7 @@
#define ENGINE_STORAGE_H #define ENGINE_STORAGE_H
#include <base/hash.h> #include <base/hash.h>
#include <base/types.h>
#include "kernel.h" #include "kernel.h"

View file

@ -3,17 +3,10 @@
struct SWarning struct SWarning
{ {
SWarning() {} SWarning() = default;
SWarning(const char *pMsg) SWarning(const char *pMsg);
{ SWarning(const char *pTitle, const char *pMsg);
str_copy(m_aWarningTitle, "");
str_copy(m_aWarningMsg, pMsg);
}
SWarning(const char *pTitle, const char *pMsg)
{
str_copy(m_aWarningTitle, pTitle);
str_copy(m_aWarningMsg, pMsg);
}
char m_aWarningTitle[128]; char m_aWarningTitle[128];
char m_aWarningMsg[256]; char m_aWarningMsg[256];
bool m_WasShown = false; bool m_WasShown = false;

View file

@ -3,8 +3,6 @@
#ifndef GAME_CLIENT_COMPONENTS_VOTING_H #ifndef GAME_CLIENT_COMPONENTS_VOTING_H
#define GAME_CLIENT_COMPONENTS_VOTING_H #define GAME_CLIENT_COMPONENTS_VOTING_H
#include <base/system.h>
#include <engine/console.h> #include <engine/console.h>
#include <engine/shared/memheap.h> #include <engine/shared/memheap.h>

View file

@ -1,8 +1,7 @@
#ifndef GAME_EDITOR_MAPITEMS_SOUND_H #ifndef GAME_EDITOR_MAPITEMS_SOUND_H
#define GAME_EDITOR_MAPITEMS_SOUND_H #define GAME_EDITOR_MAPITEMS_SOUND_H
#include <base/system.h> #include <base/types.h>
#include <game/editor/component.h> #include <game/editor/component.h>
class CEditorSound : public CEditorComponent class CEditorSound : public CEditorComponent

View file

@ -3,7 +3,6 @@
#ifndef GAME_GAMECORE_H #ifndef GAME_GAMECORE_H
#define GAME_GAMECORE_H #define GAME_GAMECORE_H
#include <base/system.h>
#include <base/vmath.h> #include <base/vmath.h>
#include <map> #include <map>
@ -191,7 +190,10 @@ class CWorldCore
public: public:
CWorldCore() CWorldCore()
{ {
mem_zero(m_apCharacters, sizeof(m_apCharacters)); for(auto &pCharacter : m_apCharacters)
{
pCharacter = nullptr;
}
m_pPrng = nullptr; m_pPrng = nullptr;
} }

View file

@ -1,5 +1,6 @@
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */ /* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
#include "teamscore.h" #include "teamscore.h"
#include <base/system.h>
#include <engine/shared/config.h> #include <engine/shared/config.h>
CTeamsCore::CTeamsCore() CTeamsCore::CTeamsCore()

View file

@ -1,6 +1,7 @@
#include "test.h" #include "test.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <base/system.h>
#include <engine/shared/csv.h> #include <engine/shared/csv.h>
static void Expect(int NumColumns, const char *const *ppColumns, const char *pExpected) static void Expect(int NumColumns, const char *const *ppColumns, const char *pExpected)

View file

@ -3,6 +3,7 @@
#include "test.h" #include "test.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <base/system.h>
#include <engine/shared/jsonwriter.h> #include <engine/shared/jsonwriter.h>
#include <climits> #include <climits>

View file

@ -1,6 +1,7 @@
#include "test.h" #include "test.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <base/system.h>
#include <engine/shared/linereader.h> #include <engine/shared/linereader.h>
void TestFileLineReader(const char *pWritten, bool SkipBom, std::initializer_list<const char *> pReads) void TestFileLineReader(const char *pWritten, bool SkipBom, std::initializer_list<const char *> pReads)

View file

@ -1,4 +1,5 @@
#include <base/logger.h> #include <base/logger.h>
#include <base/system.h>
#include <engine/shared/uuid_manager.h> #include <engine/shared/uuid_manager.h>
int main(int argc, const char **argv) int main(int argc, const char **argv)
{ {