mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2026-07-31 12:57:13 +02:00
Major plugin refactor and cleanup.
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
This commit is contained in:
@@ -9,61 +9,61 @@ namespace SqMod {
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Attempt to generate a moderately unique number to be used as a seed for random numbers.
|
||||
*/
|
||||
Uint32 GenerateSeed();
|
||||
uint32_t GenerateSeed();
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ReseedRandom();
|
||||
void ReseedRandom(Uint32 n);
|
||||
void ReseedRandom(uint32_t n);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Int8 GetRandomInt8();
|
||||
Int8 GetRandomInt8(Int8 n);
|
||||
Int8 GetRandomInt8(Int8 m, Int8 n);
|
||||
SQMOD_NODISCARD int8_t GetRandomInt8();
|
||||
SQMOD_NODISCARD int8_t GetRandomInt8(int8_t n);
|
||||
SQMOD_NODISCARD int8_t GetRandomInt8(int8_t m, int8_t n);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Uint8 GetRandomUint8();
|
||||
Uint8 GetRandomUint8(Uint8 n);
|
||||
Uint8 GetRandomUint8(Uint8 m, Uint8 n);
|
||||
SQMOD_NODISCARD uint8_t GetRandomUint8();
|
||||
SQMOD_NODISCARD uint8_t GetRandomUint8(uint8_t n);
|
||||
SQMOD_NODISCARD uint8_t GetRandomUint8(uint8_t m, uint8_t n);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Int16 GetRandomInt16();
|
||||
Int16 GetRandomInt16(Int16 n);
|
||||
Int16 GetRandomInt16(Int16 m, Int16 n);
|
||||
SQMOD_NODISCARD int16_t GetRandomInt16();
|
||||
SQMOD_NODISCARD int16_t GetRandomInt16(int16_t n);
|
||||
SQMOD_NODISCARD int16_t GetRandomInt16(int16_t m, int16_t n);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Uint16 GetRandomUint16();
|
||||
Uint16 GetRandomUint16(Uint16 n);
|
||||
Uint16 GetRandomUint16(Uint16 m, Uint16 n);
|
||||
SQMOD_NODISCARD uint16_t GetRandomUint16();
|
||||
SQMOD_NODISCARD uint16_t GetRandomUint16(uint16_t n);
|
||||
SQMOD_NODISCARD uint16_t GetRandomUint16(uint16_t m, uint16_t n);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Int32 GetRandomInt32();
|
||||
Int32 GetRandomInt32(Int32 n);
|
||||
Int32 GetRandomInt32(Int32 m, Int32 n);
|
||||
SQMOD_NODISCARD int32_t GetRandomInt32();
|
||||
SQMOD_NODISCARD int32_t GetRandomInt32(int32_t n);
|
||||
SQMOD_NODISCARD int32_t GetRandomInt32(int32_t m, int32_t n);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Uint32 GetRandomUint32();
|
||||
Uint32 GetRandomUint32(Uint32 n);
|
||||
Uint32 GetRandomUint32(Uint32 m, Uint32 n);
|
||||
SQMOD_NODISCARD uint32_t GetRandomUint32();
|
||||
SQMOD_NODISCARD uint32_t GetRandomUint32(uint32_t n);
|
||||
SQMOD_NODISCARD uint32_t GetRandomUint32(uint32_t m, uint32_t n);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Int64 GetRandomInt64();
|
||||
Int64 GetRandomInt64(Int64 n);
|
||||
Int64 GetRandomInt64(Int64 m, Int64 n);
|
||||
SQMOD_NODISCARD int64_t GetRandomInt64();
|
||||
SQMOD_NODISCARD int64_t GetRandomInt64(int64_t n);
|
||||
SQMOD_NODISCARD int64_t GetRandomInt64(int64_t m, int64_t n);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Uint64 GetRandomUint64();
|
||||
Uint64 GetRandomUint64(Uint64 n);
|
||||
Uint64 GetRandomUint64(Uint64 m, Uint64 n);
|
||||
SQMOD_NODISCARD uint64_t GetRandomUint64();
|
||||
SQMOD_NODISCARD uint64_t GetRandomUint64(uint64_t n);
|
||||
SQMOD_NODISCARD uint64_t GetRandomUint64(uint64_t m, uint64_t n);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Float32 GetRandomFloat32();
|
||||
Float32 GetRandomFloat32(Float32 n);
|
||||
Float32 GetRandomFloat32(Float32 m, Float32 n);
|
||||
SQMOD_NODISCARD float GetRandomFloat32();
|
||||
SQMOD_NODISCARD float GetRandomFloat32(float n);
|
||||
SQMOD_NODISCARD float GetRandomFloat32(float m, float n);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Float64 GetRandomFloat64();
|
||||
Float64 GetRandomFloat64(Float64 n);
|
||||
Float64 GetRandomFloat64(Float64 m, Float64 n);
|
||||
SQMOD_NODISCARD double GetRandomFloat64();
|
||||
SQMOD_NODISCARD double GetRandomFloat64(double n);
|
||||
SQMOD_NODISCARD double GetRandomFloat64(double m, double n);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void GetRandomString(String & str, String::size_type len);
|
||||
@@ -71,85 +71,85 @@ void GetRandomString(String & str, String::size_type len, String::value_type n);
|
||||
void GetRandomString(String & str, String::size_type len, String::value_type m, String::value_type n);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool GetRandomBool();
|
||||
SQMOD_NODISCARD bool GetRandomBool();
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <typename T> struct RandomVal
|
||||
{ /* ... */ };
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <> struct RandomVal< Int8 >
|
||||
template <> struct RandomVal< int8_t >
|
||||
{
|
||||
static inline Int8 Get() { return GetRandomInt8(); }
|
||||
static inline Int8 Get(Int8 n) { return GetRandomInt8(n); }
|
||||
static inline Int8 Get(Int8 m, Int8 n) { return GetRandomInt8(m, n); }
|
||||
static inline int8_t Get() { return GetRandomInt8(); }
|
||||
static inline int8_t Get(int8_t n) { return GetRandomInt8(n); }
|
||||
static inline int8_t Get(int8_t m, int8_t n) { return GetRandomInt8(m, n); }
|
||||
};
|
||||
|
||||
template <> struct RandomVal< Uint8 >
|
||||
template <> struct RandomVal< uint8_t >
|
||||
{
|
||||
static inline Uint8 Get() { return GetRandomUint8(); }
|
||||
static inline Uint8 Get(Uint8 n) { return GetRandomUint8(n); }
|
||||
static inline Uint8 Get(Uint8 m, Uint8 n) { return GetRandomUint8(m, n); }
|
||||
static inline uint8_t Get() { return GetRandomUint8(); }
|
||||
static inline uint8_t Get(uint8_t n) { return GetRandomUint8(n); }
|
||||
static inline uint8_t Get(uint8_t m, uint8_t n) { return GetRandomUint8(m, n); }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <> struct RandomVal< Int16 >
|
||||
template <> struct RandomVal< int16_t >
|
||||
{
|
||||
static inline Int16 Get() { return GetRandomInt16(); }
|
||||
static inline Int16 Get(Int16 n) { return GetRandomInt16(n); }
|
||||
static inline Int16 Get(Int16 m, Int16 n) { return GetRandomInt16(m, n); }
|
||||
static inline int16_t Get() { return GetRandomInt16(); }
|
||||
static inline int16_t Get(int16_t n) { return GetRandomInt16(n); }
|
||||
static inline int16_t Get(int16_t m, int16_t n) { return GetRandomInt16(m, n); }
|
||||
};
|
||||
|
||||
template <> struct RandomVal< Uint16 >
|
||||
template <> struct RandomVal< uint16_t >
|
||||
{
|
||||
static inline Uint16 Get() { return GetRandomUint16(); }
|
||||
static inline Uint16 Get(Uint16 n) { return GetRandomUint16(n); }
|
||||
static inline Uint16 Get(Uint16 m, Uint16 n) { return GetRandomUint16(m, n); }
|
||||
static inline uint16_t Get() { return GetRandomUint16(); }
|
||||
static inline uint16_t Get(uint16_t n) { return GetRandomUint16(n); }
|
||||
static inline uint16_t Get(uint16_t m, uint16_t n) { return GetRandomUint16(m, n); }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <> struct RandomVal< Int32 >
|
||||
template <> struct RandomVal< int32_t >
|
||||
{
|
||||
static inline Int32 Get() { return GetRandomInt32(); }
|
||||
static inline Int32 Get(Int32 n) { return GetRandomInt32(n); }
|
||||
static inline Int32 Get(Int32 m, Int32 n) { return GetRandomInt32(m, n); }
|
||||
static inline int32_t Get() { return GetRandomInt32(); }
|
||||
static inline int32_t Get(int32_t n) { return GetRandomInt32(n); }
|
||||
static inline int32_t Get(int32_t m, int32_t n) { return GetRandomInt32(m, n); }
|
||||
};
|
||||
|
||||
template <> struct RandomVal< Uint32 >
|
||||
template <> struct RandomVal< uint32_t >
|
||||
{
|
||||
static inline Uint32 Get() { return GetRandomUint32(); }
|
||||
static inline Uint32 Get(Uint32 n) { return GetRandomUint32(n); }
|
||||
static inline Uint32 Get(Uint32 m, Uint32 n) { return GetRandomUint32(m, n); }
|
||||
static inline uint32_t Get() { return GetRandomUint32(); }
|
||||
static inline uint32_t Get(uint32_t n) { return GetRandomUint32(n); }
|
||||
static inline uint32_t Get(uint32_t m, uint32_t n) { return GetRandomUint32(m, n); }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <> struct RandomVal< Int64 >
|
||||
template <> struct RandomVal< int64_t >
|
||||
{
|
||||
static inline Int64 Get() { return GetRandomInt64(); }
|
||||
static inline Int64 Get(Int64 n) { return GetRandomInt64(n); }
|
||||
static inline Int64 Get(Int64 m, Int64 n) { return GetRandomInt64(m, n); }
|
||||
static inline int64_t Get() { return GetRandomInt64(); }
|
||||
static inline int64_t Get(int64_t n) { return GetRandomInt64(n); }
|
||||
static inline int64_t Get(int64_t m, int64_t n) { return GetRandomInt64(m, n); }
|
||||
};
|
||||
|
||||
template <> struct RandomVal< Uint64 >
|
||||
template <> struct RandomVal< uint64_t >
|
||||
{
|
||||
static inline Uint64 Get() { return GetRandomUint64(); }
|
||||
static inline Uint64 Get(Uint64 n) { return GetRandomUint64(n); }
|
||||
static inline Uint64 Get(Uint64 m, Uint64 n) { return GetRandomUint64(m, n); }
|
||||
static inline uint64_t Get() { return GetRandomUint64(); }
|
||||
static inline uint64_t Get(uint64_t n) { return GetRandomUint64(n); }
|
||||
static inline uint64_t Get(uint64_t m, uint64_t n) { return GetRandomUint64(m, n); }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <> struct RandomVal< Float32 >
|
||||
template <> struct RandomVal< float >
|
||||
{
|
||||
static inline Float32 Get() { return GetRandomFloat32(); }
|
||||
static inline Float32 Get(Float32 n) { return GetRandomFloat32(n); }
|
||||
static inline Float32 Get(Float32 m, Float32 n) { return GetRandomFloat32(m, n); }
|
||||
static inline float Get() { return GetRandomFloat32(); }
|
||||
static inline float Get(float n) { return GetRandomFloat32(n); }
|
||||
static inline float Get(float m, float n) { return GetRandomFloat32(m, n); }
|
||||
};
|
||||
|
||||
template <> struct RandomVal< Float64 >
|
||||
template <> struct RandomVal< double >
|
||||
{
|
||||
static inline Float64 Get() { return GetRandomFloat64(); }
|
||||
static inline Float64 Get(Float64 n) { return GetRandomFloat64(n); }
|
||||
static inline Float64 Get(Float64 m, Float64 n) { return GetRandomFloat64(m, n); }
|
||||
static inline double Get() { return GetRandomFloat64(); }
|
||||
static inline double Get(double n) { return GetRandomFloat64(n); }
|
||||
static inline double Get(double m, double n) { return GetRandomFloat64(m, n); }
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user