mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #5547
5547: Minor tweaks to keep ODR across translation units r=def- a=Jupeyy <!-- What is the motivation for the changes of this pull request --> ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Jupeyy <jupjopjap@gmail.com>
This commit is contained in:
commit
b79bb7e62a
|
@ -1,19 +1,10 @@
|
||||||
#include <base/detect.h>
|
#include <base/detect.h>
|
||||||
|
|
||||||
#if defined(CONF_FAMILY_WINDOWS)
|
|
||||||
// For FlashWindowEx, FLASHWINFO, FLASHW_TRAY
|
|
||||||
#define _WIN32_WINNT 0x0501
|
|
||||||
#define WINVER 0x0501
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CONF_BACKEND_OPENGL_ES
|
#ifndef CONF_BACKEND_OPENGL_ES
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL_hints.h>
|
|
||||||
#include <SDL_pixels.h>
|
|
||||||
#include <SDL_video.h>
|
|
||||||
|
|
||||||
#include <base/detect.h>
|
#include <base/detect.h>
|
||||||
#include <base/math.h>
|
#include <base/math.h>
|
||||||
|
@ -51,12 +42,6 @@
|
||||||
|
|
||||||
class IStorage;
|
class IStorage;
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
|
||||||
extern "C" {
|
|
||||||
int putenv(const char *);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ------------ CGraphicsBackend_Threaded
|
// ------------ CGraphicsBackend_Threaded
|
||||||
|
|
||||||
void CGraphicsBackend_Threaded::ThreadFunc(void *pUser)
|
void CGraphicsBackend_Threaded::ThreadFunc(void *pUser)
|
||||||
|
|
|
@ -2381,10 +2381,10 @@ void CClient::FinishDDNetInfo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::tuple<int, int, int> Version;
|
typedef std::tuple<int, int, int> TVersion;
|
||||||
static const Version InvalidVersion = std::make_tuple(-1, -1, -1);
|
static const TVersion InvalidVersion = std::make_tuple(-1, -1, -1);
|
||||||
|
|
||||||
Version ToVersion(char *pStr)
|
TVersion ToVersion(char *pStr)
|
||||||
{
|
{
|
||||||
int version[3] = {0, 0, 0};
|
int version[3] = {0, 0, 0};
|
||||||
const char *p = strtok(pStr, ".");
|
const char *p = strtok(pStr, ".");
|
||||||
|
|
|
@ -39,11 +39,6 @@ struct CItemEx
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int GetTypeFromIndex(int Index)
|
|
||||||
{
|
|
||||||
return ITEMTYPE_EX - Index - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct CDatafileItemType
|
struct CDatafileItemType
|
||||||
{
|
{
|
||||||
int m_Type;
|
int m_Type;
|
||||||
|
@ -582,6 +577,11 @@ bool CDataFileWriter::Open(class IStorage *pStorage, const char *pFilename, int
|
||||||
return OpenFile(pStorage, pFilename, StorageType);
|
return OpenFile(pStorage, pFilename, StorageType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CDataFileWriter::GetTypeFromIndex(int Index)
|
||||||
|
{
|
||||||
|
return ITEMTYPE_EX - Index - 1;
|
||||||
|
}
|
||||||
|
|
||||||
int CDataFileWriter::GetExtendedItemTypeIndex(int Type)
|
int CDataFileWriter::GetExtendedItemTypeIndex(int Type)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < m_NumExtendedItemTypes; i++)
|
for(int i = 0; i < m_NumExtendedItemTypes; i++)
|
||||||
|
|
|
@ -100,6 +100,7 @@ class CDataFileWriter
|
||||||
int m_aExtendedItemTypes[MAX_EXTENDED_ITEM_TYPES];
|
int m_aExtendedItemTypes[MAX_EXTENDED_ITEM_TYPES];
|
||||||
|
|
||||||
int GetExtendedItemTypeIndex(int Type);
|
int GetExtendedItemTypeIndex(int Type);
|
||||||
|
int GetTypeFromIndex(int Index);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CDataFileWriter();
|
CDataFileWriter();
|
||||||
|
|
|
@ -584,7 +584,7 @@ int CSnapshotBuilder::Finish(void *pSnapData)
|
||||||
return sizeof(CSnapshot) + OffsetSize + m_DataSize;
|
return sizeof(CSnapshot) + OffsetSize + m_DataSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GetTypeFromIndex(int Index)
|
int CSnapshotBuilder::GetTypeFromIndex(int Index)
|
||||||
{
|
{
|
||||||
return CSnapshot::MAX_TYPE - Index;
|
return CSnapshot::MAX_TYPE - Index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,6 +144,7 @@ class CSnapshotBuilder
|
||||||
|
|
||||||
void AddExtendedItemType(int Index);
|
void AddExtendedItemType(int Index);
|
||||||
int GetExtendedItemTypeIndex(int TypeID);
|
int GetExtendedItemTypeIndex(int TypeID);
|
||||||
|
int GetTypeFromIndex(int Index);
|
||||||
|
|
||||||
bool m_Sixup;
|
bool m_Sixup;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue