mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-03-16 22:15:15 +00:00
refactor(Core): apply clang-tidy modernize-use-nodiscard (#3835)
This commit is contained in:
@@ -100,7 +100,7 @@ public:
|
||||
delete[] dat.primBound;
|
||||
delete[] dat.indices;
|
||||
}
|
||||
uint32 primCount() const { return objects.size(); }
|
||||
[[nodiscard]] uint32 primCount() const { return objects.size(); }
|
||||
|
||||
template<typename RayCallback>
|
||||
void intersectRay(const G3D::Ray& r, RayCallback& intersectCallback, float& maxDist, bool stopAtFirstHit) const
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
DynamicMapTree();
|
||||
~DynamicMapTree();
|
||||
|
||||
bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2,
|
||||
[[nodiscard]] bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2,
|
||||
float z2, uint32 phasemask) const;
|
||||
|
||||
bool getIntersectionTime(uint32 phasemask, const G3D::Ray& ray,
|
||||
@@ -37,12 +37,12 @@ public:
|
||||
const G3D::Vector3& pPos2, G3D::Vector3& pResultHitPos,
|
||||
float pModifyDist) const;
|
||||
|
||||
float getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const;
|
||||
[[nodiscard]] float getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const;
|
||||
|
||||
void insert(const GameObjectModel&);
|
||||
void remove(const GameObjectModel&);
|
||||
bool contains(const GameObjectModel&) const;
|
||||
int size() const;
|
||||
[[nodiscard]] bool contains(const GameObjectModel&) const;
|
||||
[[nodiscard]] int size() const;
|
||||
|
||||
void balance();
|
||||
void update(uint32 diff);
|
||||
|
||||
@@ -71,11 +71,11 @@ namespace VMAP
|
||||
*/
|
||||
void setEnableHeightCalc(bool pVal) { iEnableHeightCalc = pVal; }
|
||||
|
||||
bool isLineOfSightCalcEnabled() const { return (iEnableLineOfSightCalc); }
|
||||
bool isHeightCalcEnabled() const { return (iEnableHeightCalc); }
|
||||
bool isMapLoadingEnabled() const { return (iEnableLineOfSightCalc || iEnableHeightCalc ); }
|
||||
[[nodiscard]] bool isLineOfSightCalcEnabled() const { return (iEnableLineOfSightCalc); }
|
||||
[[nodiscard]] bool isHeightCalcEnabled() const { return (iEnableHeightCalc); }
|
||||
[[nodiscard]] bool isMapLoadingEnabled() const { return (iEnableLineOfSightCalc || iEnableHeightCalc ); }
|
||||
|
||||
virtual std::string getDirFileName(unsigned int pMapId, int x, int y) const = 0;
|
||||
[[nodiscard]] virtual std::string getDirFileName(unsigned int pMapId, int x, int y) const = 0;
|
||||
/**
|
||||
Query world model area info.
|
||||
\param z gets adjusted to the ground height for which this are info is valid
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace VMAP
|
||||
|
||||
public:
|
||||
// public for debug
|
||||
G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const;
|
||||
[[nodiscard]] G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const;
|
||||
static std::string getMapFileName(unsigned int mapId);
|
||||
|
||||
VMapManager2();
|
||||
@@ -108,7 +108,7 @@ namespace VMAP
|
||||
void releaseModelInstance(const std::string& filename);
|
||||
|
||||
// what's the use of this? o.O
|
||||
std::string getDirFileName(unsigned int mapId, int /*x*/, int /*y*/) const override
|
||||
[[nodiscard]] std::string getDirFileName(unsigned int mapId, int /*x*/, int /*y*/) const override
|
||||
{
|
||||
return getMapFileName(mapId);
|
||||
}
|
||||
|
||||
@@ -56,9 +56,9 @@ namespace VMAP
|
||||
StaticMapTree(uint32 mapID, const std::string& basePath);
|
||||
~StaticMapTree();
|
||||
|
||||
bool isInLineOfSight(const G3D::Vector3& pos1, const G3D::Vector3& pos2) const;
|
||||
[[nodiscard]] bool isInLineOfSight(const G3D::Vector3& pos1, const G3D::Vector3& pos2) const;
|
||||
bool getObjectHitPos(const G3D::Vector3& pos1, const G3D::Vector3& pos2, G3D::Vector3& pResultHitPos, float pModifyDist) const;
|
||||
float getHeight(const G3D::Vector3& pPos, float maxSearchDist) const;
|
||||
[[nodiscard]] float getHeight(const G3D::Vector3& pPos, float maxSearchDist) const;
|
||||
bool getAreaInfo(G3D::Vector3& pos, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const;
|
||||
bool GetLocationInfo(const G3D::Vector3& pos, LocationInfo& info) const;
|
||||
|
||||
@@ -66,8 +66,8 @@ namespace VMAP
|
||||
void UnloadMap(VMapManager2* vm);
|
||||
bool LoadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm);
|
||||
void UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm);
|
||||
bool isTiled() const { return iIsTiled; }
|
||||
uint32 numLoadedTiles() const { return iLoadedTiles.size(); }
|
||||
[[nodiscard]] bool isTiled() const { return iIsTiled; }
|
||||
[[nodiscard]] uint32 numLoadedTiles() const { return iLoadedTiles.size(); }
|
||||
void getModelInstances(ModelInstance*& models, uint32& count);
|
||||
};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace VMAP
|
||||
{
|
||||
iRotation = G3D::Matrix3::fromEulerAnglesZYX(G3D::pif() * iDir.y / 180.f, G3D::pif() * iDir.x / 180.f, G3D::pif() * iDir.z / 180.f);
|
||||
}
|
||||
G3D::Vector3 transform(const G3D::Vector3& pIn) const;
|
||||
[[nodiscard]] G3D::Vector3 transform(const G3D::Vector3& pIn) const;
|
||||
void moveToBasePos(const G3D::Vector3& pBasePos) { iPos -= pBasePos; }
|
||||
};
|
||||
|
||||
|
||||
@@ -40,17 +40,17 @@ class GameObjectModel /*, public Intersectable*/
|
||||
public:
|
||||
std::string name;
|
||||
|
||||
const G3D::AABox& getBounds() const { return iBound; }
|
||||
[[nodiscard]] const G3D::AABox& getBounds() const { return iBound; }
|
||||
|
||||
~GameObjectModel();
|
||||
|
||||
const G3D::Vector3& getPosition() const { return iPos;}
|
||||
[[nodiscard]] const G3D::Vector3& getPosition() const { return iPos;}
|
||||
|
||||
/** Enables\disables collision. */
|
||||
void disable() { phasemask = 0;}
|
||||
void enable(uint32 ph_mask) { phasemask = ph_mask;}
|
||||
|
||||
bool isEnabled() const {return phasemask != 0;}
|
||||
[[nodiscard]] bool isEnabled() const {return phasemask != 0;}
|
||||
|
||||
bool intersectRay(const G3D::Ray& Ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace VMAP
|
||||
bool operator==(const ModelSpawn& other) const { return ID == other.ID; }
|
||||
//uint32 hashCode() const { return ID; }
|
||||
// temp?
|
||||
const G3D::AABox& getBounds() const { return iBound; }
|
||||
[[nodiscard]] const G3D::AABox& getBounds() const { return iBound; }
|
||||
|
||||
static bool readFromFile(FILE* rf, ModelSpawn& spawn);
|
||||
static bool writeToFile(FILE* rw, const ModelSpawn& spawn);
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace VMAP
|
||||
~WmoLiquid();
|
||||
WmoLiquid& operator=(const WmoLiquid& other);
|
||||
bool GetLiquidHeight(const G3D::Vector3& pos, float& liqHeight) const;
|
||||
uint32 GetType() const { return iType; }
|
||||
[[nodiscard]] uint32 GetType() const { return iType; }
|
||||
float* GetHeightStorage() { return iHeight; }
|
||||
uint8* GetFlagsStorage() { return iFlags; }
|
||||
uint32 GetFileSize();
|
||||
@@ -74,12 +74,12 @@ namespace VMAP
|
||||
bool IntersectRay(const G3D::Ray& ray, float& distance, bool stopAtFirstHit) const;
|
||||
bool IsInsideObject(const G3D::Vector3& pos, const G3D::Vector3& down, float& z_dist) const;
|
||||
bool GetLiquidLevel(const G3D::Vector3& pos, float& liqHeight) const;
|
||||
uint32 GetLiquidType() const;
|
||||
[[nodiscard]] uint32 GetLiquidType() const;
|
||||
bool writeToFile(FILE* wf);
|
||||
bool readFromFile(FILE* rf);
|
||||
const G3D::AABox& GetBound() const { return iBound; }
|
||||
uint32 GetMogpFlags() const { return iMogpFlags; }
|
||||
uint32 GetWmoID() const { return iGroupWMOID; }
|
||||
[[nodiscard]] const G3D::AABox& GetBound() const { return iBound; }
|
||||
[[nodiscard]] uint32 GetMogpFlags() const { return iMogpFlags; }
|
||||
[[nodiscard]] uint32 GetWmoID() const { return iGroupWMOID; }
|
||||
protected:
|
||||
G3D::AABox iBound;
|
||||
uint32 iMogpFlags;// 0x8 outdor; 0x2000 indoor
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace acore
|
||||
CheckedBufferOutputIterator& operator++() { check(); ++_buf; return *this; }
|
||||
CheckedBufferOutputIterator operator++(int) { CheckedBufferOutputIterator v = *this; operator++(); return v; }
|
||||
|
||||
size_t remaining() const { return (_end - _buf); }
|
||||
[[nodiscard]] size_t remaining() const { return (_end - _buf); }
|
||||
|
||||
private:
|
||||
T* _buf;
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
return t %= bn;
|
||||
}
|
||||
|
||||
bool isZero() const;
|
||||
[[nodiscard]] bool isZero() const;
|
||||
|
||||
BigNumber ModExp(BigNumber const& bn1, BigNumber const& bn2);
|
||||
BigNumber Exp(BigNumber const&);
|
||||
@@ -80,8 +80,8 @@ public:
|
||||
|
||||
std::unique_ptr<uint8[]> AsByteArray(int32 minSize = 0, bool littleEndian = true);
|
||||
|
||||
char* AsHexStr() const;
|
||||
char* AsDecStr() const;
|
||||
[[nodiscard]] char* AsHexStr() const;
|
||||
[[nodiscard]] char* AsDecStr() const;
|
||||
|
||||
private:
|
||||
struct bignum_st* _bn;
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
void Finalize();
|
||||
|
||||
uint8* GetDigest(void) { return mDigest; };
|
||||
int GetLength(void) const { return SHA_DIGEST_LENGTH; };
|
||||
[[nodiscard]] int GetLength(void) const { return SHA_DIGEST_LENGTH; };
|
||||
|
||||
private:
|
||||
SHA_CTX mC;
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
class Record
|
||||
{
|
||||
public:
|
||||
float getFloat(size_t field) const
|
||||
[[nodiscard]] float getFloat(size_t field) const
|
||||
{
|
||||
ASSERT(field < file.fieldCount);
|
||||
float val = *reinterpret_cast<float*>(offset + file.GetOffset(field));
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
return val;
|
||||
}
|
||||
|
||||
uint32 getUInt(size_t field) const
|
||||
[[nodiscard]] uint32 getUInt(size_t field) const
|
||||
{
|
||||
ASSERT(field < file.fieldCount);
|
||||
uint32 val = *reinterpret_cast<uint32*>(offset + file.GetOffset(field));
|
||||
@@ -51,13 +51,13 @@ public:
|
||||
return val;
|
||||
}
|
||||
|
||||
uint8 getUInt8(size_t field) const
|
||||
[[nodiscard]] uint8 getUInt8(size_t field) const
|
||||
{
|
||||
ASSERT(field < file.fieldCount);
|
||||
return *reinterpret_cast<uint8*>(offset + file.GetOffset(field));
|
||||
}
|
||||
|
||||
const char* getString(size_t field) const
|
||||
[[nodiscard]] const char* getString(size_t field) const
|
||||
{
|
||||
ASSERT(field < file.fieldCount);
|
||||
size_t stringOffset = getUInt(field);
|
||||
@@ -77,11 +77,11 @@ public:
|
||||
// Get record by id
|
||||
Record getRecord(size_t id);
|
||||
|
||||
uint32 GetNumRows() const { return recordCount; }
|
||||
uint32 GetRowSize() const { return recordSize; }
|
||||
uint32 GetCols() const { return fieldCount; }
|
||||
uint32 GetOffset(size_t id) const { return (fieldsOffset != nullptr && id < fieldCount) ? fieldsOffset[id] : 0; }
|
||||
bool IsLoaded() const { return data != nullptr; }
|
||||
[[nodiscard]] uint32 GetNumRows() const { return recordCount; }
|
||||
[[nodiscard]] uint32 GetRowSize() const { return recordSize; }
|
||||
[[nodiscard]] uint32 GetCols() const { return fieldCount; }
|
||||
[[nodiscard]] uint32 GetOffset(size_t id) const { return (fieldsOffset != nullptr && id < fieldCount) ? fieldsOffset[id] : 0; }
|
||||
[[nodiscard]] bool IsLoaded() const { return data != nullptr; }
|
||||
char* AutoProduceData(char const* fmt, uint32& count, char**& indexTable);
|
||||
char* AutoProduceStrings(char const* fmt, char* dataTable);
|
||||
static uint32 GetFormatRecordSize(const char* format, int32* index_pos = nullptr);
|
||||
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
//! Keeps all our MySQL connections alive, prevent the server from disconnecting us.
|
||||
void KeepAlive();
|
||||
|
||||
char const* GetDatabaseName() const
|
||||
[[nodiscard]] char const* GetDatabaseName() const
|
||||
{
|
||||
return _connectionInfo.database.c_str();
|
||||
}
|
||||
|
||||
@@ -19,12 +19,12 @@ class Field
|
||||
|
||||
public:
|
||||
|
||||
bool GetBool() const // Wrapper, actually gets integer
|
||||
[[nodiscard]] bool GetBool() const // Wrapper, actually gets integer
|
||||
{
|
||||
return (GetUInt8() == 1);
|
||||
}
|
||||
|
||||
uint8 GetUInt8() const
|
||||
[[nodiscard]] uint8 GetUInt8() const
|
||||
{
|
||||
if (!data.value)
|
||||
return 0;
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
return static_cast<uint8>(atol((char*)data.value));
|
||||
}
|
||||
|
||||
int8 GetInt8() const
|
||||
[[nodiscard]] int8 GetInt8() const
|
||||
{
|
||||
if (!data.value)
|
||||
return 0;
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
uint16 GetUInt16() const
|
||||
[[nodiscard]] uint16 GetUInt16() const
|
||||
{
|
||||
if (!data.value)
|
||||
return 0;
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
return static_cast<uint16>(atol((char*)data.value));
|
||||
}
|
||||
|
||||
int16 GetInt16() const
|
||||
[[nodiscard]] int16 GetInt16() const
|
||||
{
|
||||
if (!data.value)
|
||||
return 0;
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
return static_cast<int16>(atol((char*)data.value));
|
||||
}
|
||||
|
||||
uint32 GetUInt32() const
|
||||
[[nodiscard]] uint32 GetUInt32() const
|
||||
{
|
||||
if (!data.value)
|
||||
return 0;
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
return static_cast<uint32>(atol((char*)data.value));
|
||||
}
|
||||
|
||||
int32 GetInt32() const
|
||||
[[nodiscard]] int32 GetInt32() const
|
||||
{
|
||||
if (!data.value)
|
||||
return 0;
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
return static_cast<int32>(atol((char*)data.value));
|
||||
}
|
||||
|
||||
uint64 GetUInt64() const
|
||||
[[nodiscard]] uint64 GetUInt64() const
|
||||
{
|
||||
if (!data.value)
|
||||
return 0;
|
||||
@@ -157,7 +157,7 @@ public:
|
||||
return static_cast<uint64>(atol((char*)data.value));
|
||||
}
|
||||
|
||||
int64 GetInt64() const
|
||||
[[nodiscard]] int64 GetInt64() const
|
||||
{
|
||||
if (!data.value)
|
||||
return 0;
|
||||
@@ -175,7 +175,7 @@ public:
|
||||
return static_cast<int64>(strtol((char*)data.value, NULL, 10));
|
||||
}
|
||||
|
||||
float GetFloat() const
|
||||
[[nodiscard]] float GetFloat() const
|
||||
{
|
||||
if (!data.value)
|
||||
return 0.0f;
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
return static_cast<float>(atof((char*)data.value));
|
||||
}
|
||||
|
||||
double GetDouble() const
|
||||
[[nodiscard]] double GetDouble() const
|
||||
{
|
||||
if (!data.value)
|
||||
return 0.0f;
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
return static_cast<double>(atof((char*)data.value));
|
||||
}
|
||||
|
||||
char const* GetCString() const
|
||||
[[nodiscard]] char const* GetCString() const
|
||||
{
|
||||
if (!data.value)
|
||||
return NULL;
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
std::string GetString() const
|
||||
[[nodiscard]] std::string GetString() const
|
||||
{
|
||||
if (!data.value)
|
||||
return "";
|
||||
@@ -242,7 +242,7 @@ public:
|
||||
return std::string((char*)data.value);
|
||||
}
|
||||
|
||||
bool IsNull() const
|
||||
[[nodiscard]] bool IsNull() const
|
||||
{
|
||||
return data.value == NULL;
|
||||
}
|
||||
@@ -328,12 +328,12 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
bool IsType(enum_field_types type) const
|
||||
[[nodiscard]] bool IsType(enum_field_types type) const
|
||||
{
|
||||
return data.type == type;
|
||||
}
|
||||
|
||||
bool IsNumeric() const
|
||||
[[nodiscard]] bool IsNumeric() const
|
||||
{
|
||||
return (data.type == MYSQL_TYPE_TINY ||
|
||||
data.type == MYSQL_TYPE_SHORT ||
|
||||
|
||||
@@ -124,7 +124,7 @@ protected:
|
||||
PreparedStatement* m_stmt;
|
||||
void ClearParameters();
|
||||
bool CheckValidIndex(uint8 index);
|
||||
std::string getQueryString(std::string const& sqlPattern) const;
|
||||
[[nodiscard]] std::string getQueryString(std::string const& sqlPattern) const;
|
||||
|
||||
private:
|
||||
void setValue(MYSQL_BIND* param, enum_field_types type, const void* value, uint32 len, bool isUnsigned);
|
||||
|
||||
@@ -28,12 +28,12 @@ public:
|
||||
~ResultSet();
|
||||
|
||||
bool NextRow();
|
||||
uint64 GetRowCount() const { return _rowCount; }
|
||||
uint32 GetFieldCount() const { return _fieldCount; }
|
||||
[[nodiscard]] uint64 GetRowCount() const { return _rowCount; }
|
||||
[[nodiscard]] uint32 GetFieldCount() const { return _fieldCount; }
|
||||
#ifdef ELUNA
|
||||
std::string GetFieldName(uint32 index) const;
|
||||
#endif
|
||||
Field* Fetch() const { return _currentRow; }
|
||||
[[nodiscard]] Field* Fetch() const { return _currentRow; }
|
||||
const Field& operator [] (uint32 index) const
|
||||
{
|
||||
ASSERT(index < _fieldCount);
|
||||
@@ -60,10 +60,10 @@ public:
|
||||
~PreparedResultSet();
|
||||
|
||||
bool NextRow();
|
||||
uint64 GetRowCount() const { return m_rowCount; }
|
||||
uint32 GetFieldCount() const { return m_fieldCount; }
|
||||
[[nodiscard]] uint64 GetRowCount() const { return m_rowCount; }
|
||||
[[nodiscard]] uint32 GetFieldCount() const { return m_fieldCount; }
|
||||
|
||||
Field* Fetch() const
|
||||
[[nodiscard]] Field* Fetch() const
|
||||
{
|
||||
ASSERT(m_rowPosition < m_rowCount);
|
||||
return m_rows[uint32(m_rowPosition)];
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
void Append(const char* sql);
|
||||
void PAppend(const char* sql, ...);
|
||||
|
||||
size_t GetSize() const { return m_queries.size(); }
|
||||
[[nodiscard]] size_t GetSize() const { return m_queries.size(); }
|
||||
|
||||
protected:
|
||||
void Cleanup();
|
||||
|
||||
@@ -24,19 +24,19 @@ public:
|
||||
LinkedListElement(): iNext(NULL), iPrev(NULL) { }
|
||||
~LinkedListElement() { delink(); }
|
||||
|
||||
bool hasNext() const { return (iNext && iNext->iNext != NULL); }
|
||||
bool hasPrev() const { return (iPrev && iPrev->iPrev != NULL); }
|
||||
bool isInList() const { return (iNext != NULL && iPrev != NULL); }
|
||||
[[nodiscard]] bool hasNext() const { return (iNext && iNext->iNext != NULL); }
|
||||
[[nodiscard]] bool hasPrev() const { return (iPrev && iPrev->iPrev != NULL); }
|
||||
[[nodiscard]] bool isInList() const { return (iNext != NULL && iPrev != NULL); }
|
||||
|
||||
LinkedListElement* next() { return hasNext() ? iNext : NULL; }
|
||||
LinkedListElement const* next() const { return hasNext() ? iNext : NULL; }
|
||||
[[nodiscard]] LinkedListElement const* next() const { return hasNext() ? iNext : NULL; }
|
||||
LinkedListElement* prev() { return hasPrev() ? iPrev : NULL; }
|
||||
LinkedListElement const* prev() const { return hasPrev() ? iPrev : NULL; }
|
||||
[[nodiscard]] LinkedListElement const* prev() const { return hasPrev() ? iPrev : NULL; }
|
||||
|
||||
LinkedListElement* nocheck_next() { return iNext; }
|
||||
LinkedListElement const* nocheck_next() const { return iNext; }
|
||||
[[nodiscard]] LinkedListElement const* nocheck_next() const { return iNext; }
|
||||
LinkedListElement* nocheck_prev() { return iPrev; }
|
||||
LinkedListElement const* nocheck_prev() const { return iPrev; }
|
||||
[[nodiscard]] LinkedListElement const* nocheck_prev() const { return iPrev; }
|
||||
|
||||
void delink()
|
||||
{
|
||||
@@ -83,13 +83,13 @@ public:
|
||||
iLast.iPrev = &iFirst;
|
||||
}
|
||||
|
||||
bool isEmpty() const { return (!iFirst.iNext->isInList()); }
|
||||
[[nodiscard]] bool isEmpty() const { return (!iFirst.iNext->isInList()); }
|
||||
|
||||
LinkedListElement* getFirst() { return (isEmpty() ? NULL : iFirst.iNext); }
|
||||
LinkedListElement const* getFirst() const { return (isEmpty() ? NULL : iFirst.iNext); }
|
||||
[[nodiscard]] LinkedListElement const* getFirst() const { return (isEmpty() ? NULL : iFirst.iNext); }
|
||||
|
||||
LinkedListElement* getLast() { return (isEmpty() ? NULL : iLast.iPrev); }
|
||||
LinkedListElement const* getLast() const { return (isEmpty() ? NULL : iLast.iPrev); }
|
||||
[[nodiscard]] LinkedListElement const* getLast() const { return (isEmpty() ? NULL : iLast.iPrev); }
|
||||
|
||||
void insertFirst(LinkedListElement* pElem)
|
||||
{
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
iLast.insertBefore(pElem);
|
||||
}
|
||||
|
||||
uint32 getSize() const
|
||||
[[nodiscard]] uint32 getSize() const
|
||||
{
|
||||
if (!iSize)
|
||||
{
|
||||
|
||||
@@ -19,9 +19,9 @@ public:
|
||||
virtual ~RefManager() { clearReferences(); }
|
||||
|
||||
Reference<TO, FROM>* getFirst() { return ((Reference<TO, FROM>*) LinkedListHead::getFirst()); }
|
||||
Reference<TO, FROM> const* getFirst() const { return ((Reference<TO, FROM> const*) LinkedListHead::getFirst()); }
|
||||
[[nodiscard]] Reference<TO, FROM> const* getFirst() const { return ((Reference<TO, FROM> const*) LinkedListHead::getFirst()); }
|
||||
Reference<TO, FROM>* getLast() { return ((Reference<TO, FROM>*) LinkedListHead::getLast()); }
|
||||
Reference<TO, FROM> const* getLast() const { return ((Reference<TO, FROM> const*) LinkedListHead::getLast()); }
|
||||
[[nodiscard]] Reference<TO, FROM> const* getLast() const { return ((Reference<TO, FROM> const*) LinkedListHead::getLast()); }
|
||||
|
||||
iterator begin() { return iterator(getFirst()); }
|
||||
iterator end() { return iterator(NULL); }
|
||||
|
||||
@@ -63,25 +63,25 @@ public:
|
||||
iRefTo = NULL;
|
||||
}
|
||||
|
||||
bool isValid() const // Only check the iRefTo
|
||||
[[nodiscard]] bool isValid() const // Only check the iRefTo
|
||||
{
|
||||
return iRefTo != NULL;
|
||||
}
|
||||
|
||||
Reference<TO, FROM>* next() { return ((Reference<TO, FROM>*) LinkedListElement::next()); }
|
||||
Reference<TO, FROM> const* next() const { return ((Reference<TO, FROM> const*) LinkedListElement::next()); }
|
||||
[[nodiscard]] Reference<TO, FROM> const* next() const { return ((Reference<TO, FROM> const*) LinkedListElement::next()); }
|
||||
Reference<TO, FROM>* prev() { return ((Reference<TO, FROM>*) LinkedListElement::prev()); }
|
||||
Reference<TO, FROM> const* prev() const { return ((Reference<TO, FROM> const*) LinkedListElement::prev()); }
|
||||
[[nodiscard]] Reference<TO, FROM> const* prev() const { return ((Reference<TO, FROM> const*) LinkedListElement::prev()); }
|
||||
|
||||
Reference<TO, FROM>* nocheck_next() { return ((Reference<TO, FROM>*) LinkedListElement::nocheck_next()); }
|
||||
Reference<TO, FROM> const* nocheck_next() const { return ((Reference<TO, FROM> const*) LinkedListElement::nocheck_next()); }
|
||||
[[nodiscard]] Reference<TO, FROM> const* nocheck_next() const { return ((Reference<TO, FROM> const*) LinkedListElement::nocheck_next()); }
|
||||
Reference<TO, FROM>* nocheck_prev() { return ((Reference<TO, FROM>*) LinkedListElement::nocheck_prev()); }
|
||||
Reference<TO, FROM> const* nocheck_prev() const { return ((Reference<TO, FROM> const*) LinkedListElement::nocheck_prev()); }
|
||||
[[nodiscard]] Reference<TO, FROM> const* nocheck_prev() const { return ((Reference<TO, FROM> const*) LinkedListElement::nocheck_prev()); }
|
||||
|
||||
TO* operator ->() const { return iRefTo; }
|
||||
TO* getTarget() const { return iRefTo; }
|
||||
[[nodiscard]] TO* getTarget() const { return iRefTo; }
|
||||
|
||||
FROM* GetSource() const { return iRefFrom; }
|
||||
[[nodiscard]] FROM* GetSource() const { return iRefFrom; }
|
||||
};
|
||||
|
||||
//=====================================================
|
||||
|
||||
@@ -86,7 +86,7 @@ template<class OBJECT_TYPES>
|
||||
class TypeMapContainer
|
||||
{
|
||||
public:
|
||||
template<class SPECIFIC_TYPE> size_t Count() const { return acore::Count(i_elements, (SPECIFIC_TYPE*)NULL); }
|
||||
template<class SPECIFIC_TYPE> [[nodiscard]] size_t Count() const { return acore::Count(i_elements, (SPECIFIC_TYPE*)NULL); }
|
||||
|
||||
/// inserts a specific object into the container
|
||||
template<class SPECIFIC_TYPE> bool insert(SPECIFIC_TYPE* obj)
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
//}
|
||||
|
||||
ContainerMapList<OBJECT_TYPES>& GetElements(void) { return i_elements; }
|
||||
const ContainerMapList<OBJECT_TYPES>& GetElements(void) const { return i_elements;}
|
||||
[[nodiscard]] const ContainerMapList<OBJECT_TYPES>& GetElements(void) const { return i_elements;}
|
||||
|
||||
private:
|
||||
ContainerMapList<OBJECT_TYPES> i_elements;
|
||||
|
||||
@@ -58,12 +58,12 @@ public:
|
||||
void SetSQLDriverQueryLogging(bool newStatus) { m_sqlDriverQueryLogging = newStatus; }
|
||||
void SetRealmID(uint32 id) { realm = id; }
|
||||
|
||||
bool IsOutDebug() const { return m_logLevel > 2 || (m_logFileLevel > 2 && logfile); }
|
||||
bool IsOutCharDump() const { return m_charLog_Dump; }
|
||||
[[nodiscard]] bool IsOutDebug() const { return m_logLevel > 2 || (m_logFileLevel > 2 && logfile); }
|
||||
[[nodiscard]] bool IsOutCharDump() const { return m_charLog_Dump; }
|
||||
|
||||
bool GetLogDB() const { return m_enableLogDB; }
|
||||
[[nodiscard]] bool GetLogDB() const { return m_enableLogDB; }
|
||||
void SetLogDB(bool enable) { m_enableLogDB = enable; }
|
||||
bool GetSQLDriverQueryLogging() const { return m_sqlDriverQueryLogging; }
|
||||
[[nodiscard]] bool GetSQLDriverQueryLogging() const { return m_sqlDriverQueryLogging; }
|
||||
private:
|
||||
FILE* openLogFile(char const* configFileName, char const* configTimeStampFlag, char const* mode);
|
||||
FILE* openGmlogPerAccount(uint32 account);
|
||||
|
||||
@@ -24,7 +24,7 @@ class ByteBufferException : public std::exception
|
||||
public:
|
||||
~ByteBufferException() throw() override { }
|
||||
|
||||
char const* what() const throw() override { return msg_.c_str(); }
|
||||
[[nodiscard]] char const* what() const throw() override { return msg_.c_str(); }
|
||||
|
||||
protected:
|
||||
std::string& message() throw() { return msg_; }
|
||||
@@ -277,7 +277,7 @@ public:
|
||||
return _storage[pos];
|
||||
}
|
||||
|
||||
size_t rpos() const { return _rpos; }
|
||||
[[nodiscard]] size_t rpos() const { return _rpos; }
|
||||
|
||||
size_t rpos(size_t rpos_)
|
||||
{
|
||||
@@ -290,7 +290,7 @@ public:
|
||||
_rpos = wpos();
|
||||
}
|
||||
|
||||
size_t wpos() const { return _wpos; }
|
||||
[[nodiscard]] size_t wpos() const { return _wpos; }
|
||||
|
||||
size_t wpos(size_t wpos_)
|
||||
{
|
||||
@@ -315,7 +315,7 @@ public:
|
||||
return r;
|
||||
}
|
||||
|
||||
template <typename T> T read(size_t pos) const
|
||||
template <typename T> [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] [[nodiscard]] T read(size_t pos) const
|
||||
{
|
||||
if (pos + sizeof(T) > size())
|
||||
throw ByteBufferPositionException(false, pos, sizeof(T), size());
|
||||
@@ -385,15 +385,15 @@ public:
|
||||
return &_storage[0];
|
||||
}
|
||||
|
||||
const uint8* contents() const
|
||||
[[nodiscard]] const uint8* contents() const
|
||||
{
|
||||
if (_storage.empty())
|
||||
throw ByteBufferException();
|
||||
return &_storage[0];
|
||||
}
|
||||
|
||||
size_t size() const { return _storage.size(); }
|
||||
bool empty() const { return _storage.empty(); }
|
||||
[[nodiscard]] size_t size() const { return _storage.size(); }
|
||||
[[nodiscard]] bool empty() const { return _storage.empty(); }
|
||||
|
||||
void resize(size_t newsize)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
m_opcode = opcode;
|
||||
}
|
||||
|
||||
uint16 GetOpcode() const { return m_opcode; }
|
||||
[[nodiscard]] uint16 GetOpcode() const { return m_opcode; }
|
||||
void SetOpcode(uint16 opcode) { m_opcode = opcode; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
// e_time is execution time, p_time is update interval
|
||||
virtual bool Execute(uint64 /*e_time*/, uint32 /*p_time*/) { return true; }
|
||||
|
||||
virtual bool IsDeletable() const { return true; } // this event can be safely deleted
|
||||
[[nodiscard]] virtual bool IsDeletable() const { return true; } // this event can be safely deleted
|
||||
|
||||
virtual void Abort(uint64 /*e_time*/) { } // this method executes when the event is aborted
|
||||
|
||||
@@ -52,10 +52,10 @@ public:
|
||||
void Update(uint32 p_time);
|
||||
void KillAllEvents(bool force);
|
||||
void AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime = true);
|
||||
uint64 CalculateTime(uint64 t_offset) const;
|
||||
[[nodiscard]] uint64 CalculateTime(uint64 t_offset) const;
|
||||
|
||||
// Xinef: calculates next queue tick time
|
||||
uint64 CalculateQueueTime(uint64 delay) const;
|
||||
[[nodiscard]] uint64 CalculateQueueTime(uint64 delay) const;
|
||||
|
||||
protected:
|
||||
uint64 m_time;
|
||||
|
||||
@@ -85,12 +85,12 @@ public:
|
||||
_interval = interval;
|
||||
}
|
||||
|
||||
time_t GetInterval() const
|
||||
[[nodiscard]] time_t GetInterval() const
|
||||
{
|
||||
return _interval;
|
||||
}
|
||||
|
||||
time_t GetCurrent() const
|
||||
[[nodiscard]] time_t GetCurrent() const
|
||||
{
|
||||
return _current;
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
i_expiryTime -= diff;
|
||||
}
|
||||
|
||||
bool Passed() const
|
||||
[[nodiscard]] bool Passed() const
|
||||
{
|
||||
return i_expiryTime <= 0;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
i_expiryTime = interval;
|
||||
}
|
||||
|
||||
time_t GetExpiry() const
|
||||
[[nodiscard]] time_t GetExpiry() const
|
||||
{
|
||||
return i_expiryTime;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
i_expiryTime -= diff;
|
||||
}
|
||||
|
||||
bool Passed() const
|
||||
[[nodiscard]] bool Passed() const
|
||||
{
|
||||
return i_expiryTime <= 0;
|
||||
}
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
i_expiryTime = interval;
|
||||
}
|
||||
|
||||
int32 GetExpiry() const
|
||||
[[nodiscard]] int32 GetExpiry() const
|
||||
{
|
||||
return i_expiryTime;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ public:
|
||||
|
||||
// Tracker interface
|
||||
void TUpdate(int32 diff) { i_expireTime -= diff; }
|
||||
bool TPassed() const { return i_expireTime <= 0; }
|
||||
[[nodiscard]] bool TPassed() const { return i_expireTime <= 0; }
|
||||
void TReset(int32 diff, int32 period) { i_expireTime += period > diff ? period : diff; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -43,10 +43,10 @@ public:
|
||||
Tokenizer(const std::string& src, char const sep, uint32 vectorReserve = 0);
|
||||
~Tokenizer() { delete[] m_str; }
|
||||
|
||||
const_iterator begin() const { return m_storage.begin(); }
|
||||
const_iterator end() const { return m_storage.end(); }
|
||||
[[nodiscard]] const_iterator begin() const { return m_storage.begin(); }
|
||||
[[nodiscard]] const_iterator end() const { return m_storage.end(); }
|
||||
|
||||
size_type size() const { return m_storage.size(); }
|
||||
[[nodiscard]] size_type size() const { return m_storage.size(); }
|
||||
|
||||
reference operator [] (size_type i) { return m_storage[i]; }
|
||||
const_reference operator [] (size_type i) const { return m_storage[i]; }
|
||||
@@ -404,12 +404,12 @@ public:
|
||||
part[2] = p3;
|
||||
}
|
||||
|
||||
inline bool IsEqual(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0) const
|
||||
[[nodiscard]] inline bool IsEqual(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0) const
|
||||
{
|
||||
return (part[0] == p1 && part[1] == p2 && part[2] == p3);
|
||||
}
|
||||
|
||||
inline bool HasFlag(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0) const
|
||||
[[nodiscard]] inline bool HasFlag(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0) const
|
||||
{
|
||||
return (part[0] & p1 || part[1] & p2 || part[2] & p3);
|
||||
}
|
||||
@@ -605,7 +605,7 @@ public:
|
||||
* @name GetTimer
|
||||
* @return Current timer value.
|
||||
*/
|
||||
uint32 GetTimer() const
|
||||
[[nodiscard]] uint32 GetTimer() const
|
||||
{
|
||||
return _time;
|
||||
}
|
||||
@@ -619,7 +619,7 @@ public:
|
||||
* @name GetPhaseMask
|
||||
* @return Active phases as mask.
|
||||
*/
|
||||
uint8 GetPhaseMask() const
|
||||
[[nodiscard]] uint8 GetPhaseMask() const
|
||||
{
|
||||
return _phase;
|
||||
}
|
||||
@@ -628,7 +628,7 @@ public:
|
||||
* @name Empty
|
||||
* @return True, if there are no events scheduled.
|
||||
*/
|
||||
bool Empty() const
|
||||
[[nodiscard]] bool Empty() const
|
||||
{
|
||||
return _eventMap.empty();
|
||||
}
|
||||
@@ -869,7 +869,7 @@ public:
|
||||
* @param eventId Wanted event id.
|
||||
* @return Time of found event.
|
||||
*/
|
||||
uint32 GetNextEventTime(uint32 eventId) const
|
||||
[[nodiscard]] uint32 GetNextEventTime(uint32 eventId) const
|
||||
{
|
||||
if (Empty())
|
||||
{
|
||||
@@ -891,7 +891,7 @@ public:
|
||||
* @name GetNextEventTime
|
||||
* @return Time of next event.
|
||||
*/
|
||||
uint32 GetNextEventTime() const
|
||||
[[nodiscard]] uint32 GetNextEventTime() const
|
||||
{
|
||||
return Empty() ? 0 : _eventMap.begin()->first;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user