test clang-format

This commit is contained in:
GeckoEidechse 2024-08-23 23:24:52 +02:00
parent d333a966ed
commit d87395a813
13 changed files with 90 additions and 360 deletions

View file

@ -41,10 +41,7 @@ struct OverlayBase_t
struct OverlayLine_t : public OverlayBase_t
{
OverlayLine_t()
{
m_Type = OVERLAY_LINE;
}
OverlayLine_t() { m_Type = OVERLAY_LINE; }
Vector3 origin;
Vector3 dest;
@ -57,10 +54,7 @@ struct OverlayLine_t : public OverlayBase_t
struct OverlayBox_t : public OverlayBase_t
{
OverlayBox_t()
{
m_Type = OVERLAY_BOX;
}
OverlayBox_t() { m_Type = OVERLAY_BOX; }
Vector3 origin;
Vector3 mins;
@ -74,10 +68,7 @@ struct OverlayBox_t : public OverlayBase_t
struct OverlayTriangle_t : public OverlayBase_t
{
OverlayTriangle_t()
{
m_Type = OVERLAY_TRIANGLE;
}
OverlayTriangle_t() { m_Type = OVERLAY_TRIANGLE; }
Vector3 p1;
Vector3 p2;
@ -91,10 +82,7 @@ struct OverlayTriangle_t : public OverlayBase_t
struct OverlaySweptBox_t : public OverlayBase_t
{
OverlaySweptBox_t()
{
m_Type = OVERLAY_SWEPT_BOX;
}
OverlaySweptBox_t() { m_Type = OVERLAY_SWEPT_BOX; }
Vector3 start;
Vector3 end;
@ -109,10 +97,7 @@ struct OverlaySweptBox_t : public OverlayBase_t
struct OverlaySphere_t : public OverlayBase_t
{
OverlaySphere_t()
{
m_Type = OVERLAY_SPHERE;
}
OverlaySphere_t() { m_Type = OVERLAY_SPHERE; }
Vector3 vOrigin;
float flRadius;

View file

@ -327,10 +327,7 @@ public:
pAutohook->vars.push_back(this);
}
void Dispatch()
{
*m_pTarget = (void*)ParseDLLOffsetString(m_pAddrString);
}
void Dispatch() { *m_pTarget = (void*)ParseDLLOffsetString(m_pAddrString); }
};
// VAR_AT(engine.dll+0x404, ConVar*, Cvar_host_timescale)

View file

@ -90,25 +90,13 @@ enum EBitCoordType
class BitBufferBase
{
protected:
INLINE void SetName(const char* name)
{
m_BufferName = name;
}
INLINE void SetName(const char* name) { m_BufferName = name; }
public:
INLINE bool IsOverflowed()
{
return m_Overflow;
}
INLINE void SetOverflowed()
{
m_Overflow = true;
}
INLINE bool IsOverflowed() { return m_Overflow; }
INLINE void SetOverflowed() { m_Overflow = true; }
INLINE const char* GetName()
{
return m_BufferName;
}
INLINE const char* GetName() { return m_BufferName; }
private:
const char* m_BufferName = "";
@ -437,28 +425,13 @@ public:
return fReturn;
}
INLINE i32 ReadChar()
{
return ReadSBitLong(sizeof(char) << 3);
}
INLINE u32 ReadByte()
{
return ReadUBitLong(sizeof(unsigned char) << 3);
}
INLINE i32 ReadChar() { return ReadSBitLong(sizeof(char) << 3); }
INLINE u32 ReadByte() { return ReadUBitLong(sizeof(unsigned char) << 3); }
INLINE i32 ReadShort()
{
return ReadSBitLong(sizeof(short) << 3);
}
INLINE u32 ReadWord()
{
return ReadUBitLong(sizeof(unsigned short) << 3);
}
INLINE i32 ReadShort() { return ReadSBitLong(sizeof(short) << 3); }
INLINE u32 ReadWord() { return ReadUBitLong(sizeof(unsigned short) << 3); }
INLINE i32 ReadLong()
{
return (i32)(ReadUBitLong(sizeof(i32) << 3));
}
INLINE i32 ReadLong() { return (i32)(ReadUBitLong(sizeof(i32) << 3)); }
INLINE float ReadFloat()
{
u32 temp = ReadUBitLong(sizeof(float) << 3);
@ -687,24 +660,12 @@ public:
return std::min(nCurOfs + nAdjust, m_DataBits);
}
INLINE bool SeekRelative(size_t offset)
{
return Seek(GetNumBitsRead() + offset);
}
INLINE bool SeekRelative(size_t offset) { return Seek(GetNumBitsRead() + offset); }
INLINE size_t TotalBytesAvailable()
{
return m_DataBytes;
}
INLINE size_t TotalBytesAvailable() { return m_DataBytes; }
INLINE size_t GetNumBitsLeft()
{
return m_DataBits - GetNumBitsRead();
}
INLINE size_t GetNumBytesLeft()
{
return GetNumBitsLeft() >> 3;
}
INLINE size_t GetNumBitsLeft() { return m_DataBits - GetNumBitsRead(); }
INLINE size_t GetNumBytesLeft() { return GetNumBitsLeft() >> 3; }
private:
size_t m_DataBits; // 0x0010
@ -743,10 +704,7 @@ public:
m_DataEnd = reinterpret_cast<u32*>(reinterpret_cast<u8*>(m_Data) + m_DataBytes);
}
INLINE int GetNumBitsLeft()
{
return m_OutBitsLeft + (32 * (m_DataEnd - m_DataOut - 1));
}
INLINE int GetNumBitsLeft() { return m_OutBitsLeft + (32 * (m_DataEnd - m_DataOut - 1)); }
INLINE void Reset()
{
@ -775,10 +733,7 @@ public:
return reinterpret_cast<u8*>(m_Data);
}
INLINE u8* GetData()
{
return GetBasePointer();
}
INLINE u8* GetData() { return GetBasePointer(); }
INLINE void Finish()
{
@ -851,10 +806,7 @@ public:
}
}
INLINE void WriteSBitLong(i32 data, i32 numBits)
{
WriteUBitLong((u32)data, numBits, false);
}
INLINE void WriteSBitLong(i32 data, i32 numBits) { WriteUBitLong((u32)data, numBits, false); }
INLINE void WriteUBitVar(u32 n)
{
@ -911,40 +863,19 @@ public:
return !IsOverflowed();
}
INLINE bool WriteBytes(const uptr data, i32 numBytes)
{
return WriteBits(data, numBytes << 3);
}
INLINE bool WriteBytes(const uptr data, i32 numBytes) { return WriteBits(data, numBytes << 3); }
INLINE i32 GetNumBitsWritten()
{
return (32 - m_OutBitsLeft) + (32 * (m_DataOut - m_Data));
}
INLINE i32 GetNumBitsWritten() { return (32 - m_OutBitsLeft) + (32 * (m_DataOut - m_Data)); }
INLINE i32 GetNumBytesWritten()
{
return (GetNumBitsWritten() + 7) >> 3;
}
INLINE i32 GetNumBytesWritten() { return (GetNumBitsWritten() + 7) >> 3; }
INLINE void WriteChar(i32 val)
{
WriteSBitLong(val, sizeof(char) << 3);
}
INLINE void WriteChar(i32 val) { WriteSBitLong(val, sizeof(char) << 3); }
INLINE void WriteByte(i32 val)
{
WriteUBitLong(val, sizeof(unsigned char) << 3, false);
}
INLINE void WriteByte(i32 val) { WriteUBitLong(val, sizeof(unsigned char) << 3, false); }
INLINE void WriteShort(i32 val)
{
WriteSBitLong(val, sizeof(short) << 3);
}
INLINE void WriteShort(i32 val) { WriteSBitLong(val, sizeof(short) << 3); }
INLINE void WriteWord(i32 val)
{
WriteUBitLong(val, sizeof(unsigned short) << 3);
}
INLINE void WriteWord(i32 val) { WriteUBitLong(val, sizeof(unsigned short) << 3); }
INLINE bool WriteString(const char* str)
{

View file

@ -7,22 +7,10 @@ struct color24
typedef struct color32_s
{
bool operator!=(const struct color32_s& other) const
{
return r != other.r || g != other.g || b != other.b || a != other.a;
}
inline unsigned* asInt(void)
{
return reinterpret_cast<unsigned*>(this);
}
inline const unsigned* asInt(void) const
{
return reinterpret_cast<const unsigned*>(this);
}
inline void Copy(const color32_s& rhs)
{
*asInt() = *rhs.asInt();
}
bool operator!=(const struct color32_s& other) const { return r != other.r || g != other.g || b != other.b || a != other.a; }
inline unsigned* asInt(void) { return reinterpret_cast<unsigned*>(this); }
inline const unsigned* asInt(void) const { return reinterpret_cast<const unsigned*>(this); }
inline void Copy(const color32_s& rhs) { *asInt() = *rhs.asInt(); }
uint8_t r, g, b, a;
} color32;
@ -79,55 +67,22 @@ public:
_b = _color[2];
_a = _color[3];
}
int GetValue(int index) const
{
return _color[index];
}
void SetRawColor(int color32)
{
*((int*)this) = color32;
}
int GetRawColor(void) const
{
return *((int*)this);
}
int GetValue(int index) const { return _color[index]; }
void SetRawColor(int color32) { *((int*)this) = color32; }
int GetRawColor(void) const { return *((int*)this); }
inline int r() const
{
return _color[0];
}
inline int g() const
{
return _color[1];
}
inline int b() const
{
return _color[2];
}
inline int a() const
{
return _color[3];
}
inline int r() const { return _color[0]; }
inline int g() const { return _color[1]; }
inline int b() const { return _color[2]; }
inline int a() const { return _color[3]; }
unsigned char& operator[](int index)
{
return _color[index];
}
unsigned char& operator[](int index) { return _color[index]; }
const unsigned char& operator[](int index) const
{
return _color[index];
}
const unsigned char& operator[](int index) const { return _color[index]; }
bool operator==(const Color& rhs) const
{
return (*((int*)this) == *((int*)&rhs));
}
bool operator==(const Color& rhs) const { return (*((int*)this) == *((int*)&rhs)); }
bool operator!=(const Color& rhs) const
{
return !(operator==(rhs));
}
bool operator!=(const Color& rhs) const { return !(operator==(rhs)); }
Color& operator=(const Color& rhs)
{
@ -164,10 +119,7 @@ public:
return out;
}
SourceColor ToSourceColor()
{
return SourceColor(_color[0], _color[1], _color[2], _color[3]);
}
SourceColor ToSourceColor() { return SourceColor(_color[0], _color[1], _color[2], _color[3]); }
private:
unsigned char _color[4];

View file

@ -17,10 +17,7 @@ public:
Vector3(float _f) : x(_f), y(_f), z(_f) {}
Vector3() : x(0.0f), y(0.0f), z(0.0f) {}
inline bool IsValid()
{
return IsFinite(x) && IsFinite(y) && IsFinite(z);
}
inline bool IsValid() { return IsFinite(x) && IsFinite(y) && IsFinite(z); }
inline void Init(float fX = 0.0f, float fY = 0.0f, float fZ = 0.0f)
{
@ -29,10 +26,7 @@ public:
z = fZ;
}
inline float Length()
{
return FastSqrt(x * x + y * y + z * z);
}
inline float Length() { return FastSqrt(x * x + y * y + z * z); }
inline float DistTo(const Vector3& vOther)
{
@ -44,10 +38,7 @@ public:
return vDelta.Length();
}
float Dot(const Vector3& vOther) const
{
return x * vOther.x + y * vOther.y + z * vOther.z;
}
float Dot(const Vector3& vOther) const { return x * vOther.x + y * vOther.y + z * vOther.z; }
// Cross product between two vectors.
Vector3 Cross(const Vector3& vOther) const;
@ -318,10 +309,7 @@ public:
Vector3 GetNormal() const;
// todo: more operators maybe
bool operator==(const QAngle& other)
{
return x == other.x && y == other.y && z == other.z;
}
bool operator==(const QAngle& other) { return x == other.x && y == other.y && z == other.z; }
};
inline Vector3 QAngle::GetNormal() const

View file

@ -40,10 +40,7 @@ public:
}
return _realloc_base(originalPtr, newSize);
}
static void Free(void* ptr)
{
_free_base(ptr);
}
static void Free(void* ptr) { _free_base(ptr); }
};
typedef rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator<SourceAllocator>, SourceAllocator> rapidjson_document;

View file

@ -26,13 +26,7 @@ public:
spdlog::error("Failed to call CreateInterface for %s in %s", interfaceName, moduleName);
}
T* operator->() const
{
return m_interface;
}
T* operator->() const { return m_interface; }
operator T*() const
{
return m_interface;
}
operator T*() const { return m_interface; }
};

View file

@ -17,10 +17,7 @@ public:
m_bIsVanillaCompatible = isVanilla;
}
bool GetVanillaCompatibility()
{
return m_bIsVanillaCompatible;
}
bool GetVanillaCompatibility() { return m_bIsVanillaCompatible; }
private:
bool m_bIsVanillaCompatible = false;

View file

@ -14,35 +14,17 @@ public:
void Init();
void Shutdown();
void Lock()
{
m_Mutex.lock();
}
void Lock() { m_Mutex.lock(); }
void Unlock()
{
m_Mutex.unlock();
}
void Unlock() { m_Mutex.unlock(); }
void SetState(bool bState)
{
m_bState = bState;
}
void SetState(bool bState) { m_bState = bState; }
bool GetState() const
{
return m_bState;
}
bool GetState() const { return m_bState; }
void SetAllFatal(bool bState)
{
m_bAllExceptionsFatal = bState;
}
void SetAllFatal(bool bState) { m_bAllExceptionsFatal = bState; }
bool GetAllFatal() const
{
return m_bAllExceptionsFatal;
}
bool GetAllFatal() const { return m_bAllExceptionsFatal; }
//-----------------------------------------------------------------------------
// Exception helpers

View file

@ -107,10 +107,7 @@ public:
void StopHttpRequestHandler();
// Whether or not this http request handler is currently running.
bool IsRunning() const
{
return m_bIsHttpRequestHandlerRunning;
}
bool IsRunning() const { return m_bIsHttpRequestHandlerRunning; }
/**
* Creates a new thread to execute an HTTP request.

View file

@ -207,28 +207,16 @@ struct dtPoly
Vector3 org; //
/// Sets the user defined area id. [Limit: < #DT_MAX_AREAS]
inline void setArea(unsigned char a)
{
areaAndtype = (areaAndtype & 0xc0) | (a & 0x3f);
}
inline void setArea(unsigned char a) { areaAndtype = (areaAndtype & 0xc0) | (a & 0x3f); }
/// Sets the polygon type. (See: #dtPolyTypes.)
inline void setType(unsigned char t)
{
areaAndtype = (areaAndtype & 0x3f) | (t << 6);
}
inline void setType(unsigned char t) { areaAndtype = (areaAndtype & 0x3f) | (t << 6); }
/// Gets the user defined area id.
inline unsigned char getArea() const
{
return areaAndtype & 0x3f;
}
inline unsigned char getArea() const { return areaAndtype & 0x3f; }
/// Gets the polygon type. (See: #dtPolyTypes)
inline unsigned char getType() const
{
return areaAndtype >> 6;
}
inline unsigned char getType() const { return areaAndtype >> 6; }
};
/// Defines a link between polygons.

View file

@ -126,10 +126,7 @@ public:
#pragma endregion
#pragma region SQVM func wrappers
inline void defconst(CSquirrelVM* sqvm, const SQChar* pName, int nValue)
{
__sq_defconst(sqvm, pName, nValue);
}
inline void defconst(CSquirrelVM* sqvm, const SQChar* pName, int nValue) { __sq_defconst(sqvm, pName, nValue); }
inline SQRESULT
compilebuffer(CompileBufferState* bufferState, const SQChar* bufferName = "unnamedbuffer", const SQBool bShouldThrowError = false)
@ -137,110 +134,50 @@ public:
return __sq_compilebuffer(m_pSQVM->sqvm, bufferState, bufferName, -1, bShouldThrowError);
}
inline SQRESULT _call(HSquirrelVM* sqvm, const SQInteger args)
{
return __sq_call(sqvm, args + 1, false, true);
}
inline SQRESULT _call(HSquirrelVM* sqvm, const SQInteger args) { return __sq_call(sqvm, args + 1, false, true); }
inline SQInteger raiseerror(HSquirrelVM* sqvm, const SQChar* sError)
{
return __sq_raiseerror(sqvm, sError);
}
inline SQInteger raiseerror(HSquirrelVM* sqvm, const SQChar* sError) { return __sq_raiseerror(sqvm, sError); }
inline bool compilefile(CSquirrelVM* sqvm, const char* path, const char* name, int a4)
{
return __sq_compilefile(sqvm, path, name, a4);
}
inline void newarray(HSquirrelVM* sqvm, const SQInteger stackpos = 0)
{
__sq_newarray(sqvm, stackpos);
}
inline void newarray(HSquirrelVM* sqvm, const SQInteger stackpos = 0) { __sq_newarray(sqvm, stackpos); }
inline SQRESULT arrayappend(HSquirrelVM* sqvm, const SQInteger stackpos)
{
return __sq_arrayappend(sqvm, stackpos);
}
inline SQRESULT arrayappend(HSquirrelVM* sqvm, const SQInteger stackpos) { return __sq_arrayappend(sqvm, stackpos); }
inline SQRESULT newtable(HSquirrelVM* sqvm)
{
return __sq_newtable(sqvm);
}
inline SQRESULT newtable(HSquirrelVM* sqvm) { return __sq_newtable(sqvm); }
inline SQRESULT newslot(HSquirrelVM* sqvm, SQInteger idx, SQBool bStatic)
{
return __sq_newslot(sqvm, idx, bStatic);
}
inline SQRESULT newslot(HSquirrelVM* sqvm, SQInteger idx, SQBool bStatic) { return __sq_newslot(sqvm, idx, bStatic); }
inline void pushroottable(HSquirrelVM* sqvm)
{
__sq_pushroottable(sqvm);
}
inline void pushroottable(HSquirrelVM* sqvm) { __sq_pushroottable(sqvm); }
inline void pushstring(HSquirrelVM* sqvm, const SQChar* sVal, int length = -1)
{
__sq_pushstring(sqvm, sVal, length);
}
inline void pushstring(HSquirrelVM* sqvm, const SQChar* sVal, int length = -1) { __sq_pushstring(sqvm, sVal, length); }
inline void pushinteger(HSquirrelVM* sqvm, const SQInteger iVal)
{
__sq_pushinteger(sqvm, iVal);
}
inline void pushinteger(HSquirrelVM* sqvm, const SQInteger iVal) { __sq_pushinteger(sqvm, iVal); }
inline void pushfloat(HSquirrelVM* sqvm, const SQFloat flVal)
{
__sq_pushfloat(sqvm, flVal);
}
inline void pushfloat(HSquirrelVM* sqvm, const SQFloat flVal) { __sq_pushfloat(sqvm, flVal); }
inline void pushbool(HSquirrelVM* sqvm, const SQBool bVal)
{
__sq_pushbool(sqvm, bVal);
}
inline void pushbool(HSquirrelVM* sqvm, const SQBool bVal) { __sq_pushbool(sqvm, bVal); }
inline void pushasset(HSquirrelVM* sqvm, const SQChar* sVal, int length = -1)
{
__sq_pushasset(sqvm, sVal, length);
}
inline void pushasset(HSquirrelVM* sqvm, const SQChar* sVal, int length = -1) { __sq_pushasset(sqvm, sVal, length); }
inline void pushvector(HSquirrelVM* sqvm, const Vector3 pVal)
{
__sq_pushvector(sqvm, (float*)&pVal);
}
inline void pushvector(HSquirrelVM* sqvm, const Vector3 pVal) { __sq_pushvector(sqvm, (float*)&pVal); }
inline void pushobject(HSquirrelVM* sqvm, SQObject* obj)
{
__sq_pushobject(sqvm, obj);
}
inline void pushobject(HSquirrelVM* sqvm, SQObject* obj) { __sq_pushobject(sqvm, obj); }
inline const SQChar* getstring(HSquirrelVM* sqvm, const SQInteger stackpos)
{
return __sq_getstring(sqvm, stackpos);
}
inline const SQChar* getstring(HSquirrelVM* sqvm, const SQInteger stackpos) { return __sq_getstring(sqvm, stackpos); }
inline SQInteger getinteger(HSquirrelVM* sqvm, const SQInteger stackpos)
{
return __sq_getinteger(sqvm, stackpos);
}
inline SQInteger getinteger(HSquirrelVM* sqvm, const SQInteger stackpos) { return __sq_getinteger(sqvm, stackpos); }
inline SQFloat getfloat(HSquirrelVM* sqvm, const SQInteger stackpos)
{
return __sq_getfloat(sqvm, stackpos);
}
inline SQFloat getfloat(HSquirrelVM* sqvm, const SQInteger stackpos) { return __sq_getfloat(sqvm, stackpos); }
inline SQBool getbool(HSquirrelVM* sqvm, const SQInteger stackpos)
{
return __sq_getbool(sqvm, stackpos);
}
inline SQBool getbool(HSquirrelVM* sqvm, const SQInteger stackpos) { return __sq_getbool(sqvm, stackpos); }
inline SQRESULT get(HSquirrelVM* sqvm, const SQInteger stackpos)
{
return __sq_get(sqvm, stackpos);
}
inline SQRESULT get(HSquirrelVM* sqvm, const SQInteger stackpos) { return __sq_get(sqvm, stackpos); }
inline Vector3 getvector(HSquirrelVM* sqvm, const SQInteger stackpos)
{
return *(Vector3*)__sq_getvector(sqvm, stackpos);
}
inline Vector3 getvector(HSquirrelVM* sqvm, const SQInteger stackpos) { return *(Vector3*)__sq_getvector(sqvm, stackpos); }
inline int sq_getfunction(HSquirrelVM* sqvm, const char* name, SQObject* returnObj, const char* signature)
{
@ -291,10 +228,7 @@ public:
return __sq_setuserdatatypeid(sqvm, stackpos, typeId);
}
template <typename T> inline SQBool getthisentity(HSquirrelVM* sqvm, T* ppEntity)
{
return __sq_getthisentity(sqvm, (void**)ppEntity);
}
template <typename T> inline SQBool getthisentity(HSquirrelVM* sqvm, T* ppEntity) { return __sq_getthisentity(sqvm, (void**)ppEntity); }
template <typename T> inline T* getentity(HSquirrelVM* sqvm, SQInteger iStackPos)
{
@ -305,15 +239,9 @@ public:
return (T*)__sq_getentityfrominstance(m_pSQVM, &obj, __sq_GetEntityConstant_CBaseEntity());
}
inline SQRESULT pushnewstructinstance(HSquirrelVM* sqvm, const int fieldCount)
{
return __sq_pushnewstructinstance(sqvm, fieldCount);
}
inline SQRESULT pushnewstructinstance(HSquirrelVM* sqvm, const int fieldCount) { return __sq_pushnewstructinstance(sqvm, fieldCount); }
inline SQRESULT sealstructslot(HSquirrelVM* sqvm, const int fieldIndex)
{
return __sq_sealstructslot(sqvm, fieldIndex);
}
inline SQRESULT sealstructslot(HSquirrelVM* sqvm, const int fieldIndex) { return __sq_sealstructslot(sqvm, fieldIndex); }
#pragma endregion
};
@ -405,10 +333,7 @@ public:
#pragma endregion
public:
SquirrelManager()
{
m_pSQVM = nullptr;
}
SquirrelManager() { m_pSQVM = nullptr; }
void VMCreated(CSquirrelVM* newSqvm);
void VMDestroyed();

View file

@ -14,10 +14,7 @@ public:
if (!m_dismissed)
m_callback();
}
void Dismiss()
{
m_dismissed = true;
}
void Dismiss() { m_dismissed = true; }
private:
bool m_dismissed = false;