refactor(Core): apply clang-tidy modernize-use-nodiscard (#3835)

This commit is contained in:
Francesco Borzì
2020-12-06 19:39:48 +01:00
committed by GitHub
parent d4a58700d4
commit 161302252e
82 changed files with 1565 additions and 1569 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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);
};

View File

@@ -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; }
};

View File

@@ -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;

View File

@@ -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);

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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();
}

View File

@@ -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 ||

View File

@@ -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);

View File

@@ -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)];

View File

@@ -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();

View File

@@ -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)
{

View File

@@ -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); }

View File

@@ -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; }
};
//=====================================================

View File

@@ -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;

View File

@@ -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);

View File

@@ -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)
{

View File

@@ -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:

View File

@@ -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;

View File

@@ -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:

View File

@@ -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;
}

View File

@@ -151,8 +151,8 @@ public:
typedef std::map<std::string, PATCH_INFO*> Patches;
~Patcher();
Patcher();
Patches::const_iterator begin() const { return _patches.begin(); }
Patches::const_iterator end() const { return _patches.end(); }
[[nodiscard]] Patches::const_iterator begin() const { return _patches.begin(); }
[[nodiscard]] Patches::const_iterator end() const { return _patches.end(); }
void LoadPatchMD5(char*);
bool GetHash(char* pat, uint8 mymd5[16]);

View File

@@ -142,10 +142,6 @@ void PetAI::UpdateAI(uint32 diff)
Unit* owner = me->GetCharmerOrOwner();
//if Pet is in combat put player in combat
if (me->IsInCombat())
owner->IsInCombat();
if (m_updateAlliesTimer <= diff)
// UpdateAllies self set update timer
UpdateAllies();

View File

@@ -267,8 +267,8 @@ public:
void CheckAllAchievementCriteria();
void SendAllAchievementData() const;
void SendRespondInspectAchievements(Player* player) const;
bool HasAchieved(uint32 achievementId) const;
Player* GetPlayer() const { return m_player; }
[[nodiscard]] bool HasAchieved(uint32 achievementId) const;
[[nodiscard]] Player* GetPlayer() const { return m_player; }
void UpdateTimedAchievements(uint32 timeDiff);
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost = 0);
void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry); // used for quest and scripted timed achievements
@@ -304,7 +304,7 @@ public:
bool IsStatisticCriteria(AchievementCriteriaEntry const* achievementCriteria) const;
bool isStatisticAchievement(AchievementEntry const* achievement) const;
AchievementCriteriaEntryList const* GetAchievementCriteriaByType(AchievementCriteriaTypes type) const
[[nodiscard]] AchievementCriteriaEntryList const* GetAchievementCriteriaByType(AchievementCriteriaTypes type) const
{
return &m_AchievementCriteriasByType[type];
}
@@ -323,18 +323,18 @@ public:
return nullptr;
}
AchievementCriteriaEntryList const& GetTimedAchievementCriteriaByType(AchievementCriteriaTimedTypes type) const
[[nodiscard]] AchievementCriteriaEntryList const& GetTimedAchievementCriteriaByType(AchievementCriteriaTimedTypes type) const
{
return m_AchievementCriteriasByTimedType[type];
}
AchievementCriteriaEntryList const* GetAchievementCriteriaByAchievement(uint32 id) const
[[nodiscard]] AchievementCriteriaEntryList const* GetAchievementCriteriaByAchievement(uint32 id) const
{
AchievementCriteriaListByAchievement::const_iterator itr = m_AchievementCriteriaListByAchievement.find(id);
return itr != m_AchievementCriteriaListByAchievement.end() ? &itr->second : nullptr;
}
AchievementEntryList const* GetAchievementByReferencedId(uint32 id) const
[[nodiscard]] AchievementEntryList const* GetAchievementByReferencedId(uint32 id) const
{
AchievementListByReferencedId::const_iterator itr = m_AchievementListByReferencedId.find(id);
return itr != m_AchievementListByReferencedId.end() ? &itr->second : nullptr;

View File

@@ -68,16 +68,16 @@ struct AuctionEntry
uint32 factionTemplateId;
// helpers
uint32 GetHouseId() const { return auctionHouseEntry->houseId; }
uint32 GetHouseFaction() const { return auctionHouseEntry->faction; }
uint32 GetAuctionCut() const;
uint32 GetAuctionOutBid() const;
[[nodiscard]] uint32 GetHouseId() const { return auctionHouseEntry->houseId; }
[[nodiscard]] uint32 GetHouseFaction() const { return auctionHouseEntry->faction; }
[[nodiscard]] uint32 GetAuctionCut() const;
[[nodiscard]] uint32 GetAuctionOutBid() const;
bool BuildAuctionInfo(WorldPacket& data) const;
void DeleteFromDB(SQLTransaction& trans) const;
void SaveToDB(SQLTransaction& trans) const;
bool LoadFromDB(Field* fields);
bool LoadFromFieldList(Field* fields);
std::string BuildAuctionMailSubject(MailAuctionAnswers response) const;
[[nodiscard]] std::string BuildAuctionMailSubject(MailAuctionAnswers response) const;
static std::string BuildAuctionMailBody(uint32 lowGuid, uint32 bid, uint32 buyout, uint32 deposit, uint32 cut);
};
@@ -96,12 +96,12 @@ public:
typedef std::map<uint32, AuctionEntry*> AuctionEntryMap;
uint32 Getcount() const { return AuctionsMap.size(); }
[[nodiscard]] uint32 Getcount() const { return AuctionsMap.size(); }
AuctionEntryMap::iterator GetAuctionsBegin() {return AuctionsMap.begin();}
AuctionEntryMap::iterator GetAuctionsEnd() {return AuctionsMap.end();}
AuctionEntry* GetAuction(uint32 id) const
[[nodiscard]] AuctionEntry* GetAuction(uint32 id) const
{
AuctionEntryMap::const_iterator itr = AuctionsMap.find(id);
return itr != AuctionsMap.end() ? itr->second : nullptr;

View File

@@ -114,15 +114,15 @@ public:
typedef std::list<ArenaTeamMember> MemberList;
uint32 GetId() const { return TeamId; }
uint32 GetType() const { return Type; }
uint8 GetSlot() const { return GetSlotByType(GetType()); }
[[nodiscard]] uint32 GetId() const { return TeamId; }
[[nodiscard]] uint32 GetType() const { return Type; }
[[nodiscard]] uint8 GetSlot() const { return GetSlotByType(GetType()); }
static uint8 GetSlotByType(uint32 type);
uint64 GetCaptain() const { return CaptainGuid; }
std::string const& GetName() const { return TeamName; }
const ArenaTeamStats& GetStats() const { return Stats; }
[[nodiscard]] uint64 GetCaptain() const { return CaptainGuid; }
[[nodiscard]] std::string const& GetName() const { return TeamName; }
[[nodiscard]] const ArenaTeamStats& GetStats() const { return Stats; }
uint32 GetRating() const { return Stats.Rating; }
[[nodiscard]] uint32 GetRating() const { return Stats.Rating; }
uint32 GetAverageMMR(Group* group) const;
void SetCaptain(uint64 guid);
@@ -133,16 +133,16 @@ public:
// and this method removes given record from list. So invalid reference can happen.
void DelMember(uint64 guid, bool cleanDb);
size_t GetMembersSize() const { return Members.size(); }
bool Empty() const { return Members.empty(); }
[[nodiscard]] size_t GetMembersSize() const { return Members.size(); }
[[nodiscard]] bool Empty() const { return Members.empty(); }
MemberList::iterator m_membersBegin() { return Members.begin(); }
MemberList::iterator m_membersEnd() { return Members.end(); }
bool IsMember(uint64 guid) const;
[[nodiscard]] bool IsMember(uint64 guid) const;
ArenaTeamMember* GetMember(uint64 guid);
ArenaTeamMember* GetMember(std::string const& name);
bool IsFighting() const;
[[nodiscard]] bool IsFighting() const;
bool LoadArenaTeamFromDB(QueryResult arenaTeamDataResult);
bool LoadMembersFromDB(QueryResult arenaTeamMembersResult);

View File

@@ -256,18 +256,18 @@ struct BattlegroundScore
uint32 HealingDone;
Player* player;
uint32 GetKillingBlows() const { return KillingBlows; }
uint32 GetDeaths() const { return Deaths; }
uint32 GetHonorableKills() const { return HonorableKills; }
uint32 GetBonusHonor() const { return BonusHonor; }
uint32 GetDamageDone() const { return DamageDone; }
uint32 GetHealingDone() const { return HealingDone; }
[[nodiscard]] uint32 GetKillingBlows() const { return KillingBlows; }
[[nodiscard]] uint32 GetDeaths() const { return Deaths; }
[[nodiscard]] uint32 GetHonorableKills() const { return HonorableKills; }
[[nodiscard]] uint32 GetBonusHonor() const { return BonusHonor; }
[[nodiscard]] uint32 GetDamageDone() const { return DamageDone; }
[[nodiscard]] uint32 GetHealingDone() const { return HealingDone; }
virtual uint32 GetAttr1() const { return 0; }
virtual uint32 GetAttr2() const { return 0; }
virtual uint32 GetAttr3() const { return 0; }
virtual uint32 GetAttr4() const { return 0; }
virtual uint32 GetAttr5() const { return 0; }
[[nodiscard]] virtual uint32 GetAttr1() const { return 0; }
[[nodiscard]] virtual uint32 GetAttr2() const { return 0; }
[[nodiscard]] virtual uint32 GetAttr3() const { return 0; }
[[nodiscard]] virtual uint32 GetAttr4() const { return 0; }
[[nodiscard]] virtual uint32 GetAttr5() const { return 0; }
};
class ArenaLogEntryData
@@ -339,31 +339,31 @@ public:
virtual void DestroyGate(Player* /*player*/, GameObject* /*go*/) {}
/* achievement req. */
virtual bool AllNodesConrolledByTeam(TeamId /*teamId*/) const { return false; }
[[nodiscard]] virtual bool AllNodesConrolledByTeam(TeamId /*teamId*/) const { return false; }
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry);
/* Battleground */
// Get methods:
char const* GetName() const { return m_Name; }
BattlegroundTypeId GetBgTypeID(bool GetRandom = false) const { return GetRandom ? m_RandomTypeID : m_RealTypeID; }
uint32 GetInstanceID() const { return m_InstanceID; }
BattlegroundStatus GetStatus() const { return m_Status; }
uint32 GetClientInstanceID() const { return m_ClientInstanceID; }
uint32 GetStartTime() const { return m_StartTime; }
uint32 GetEndTime() const { return m_EndTime; }
uint32 GetLastResurrectTime() const { return m_LastResurrectTime; }
[[nodiscard]] char const* GetName() const { return m_Name; }
[[nodiscard]] BattlegroundTypeId GetBgTypeID(bool GetRandom = false) const { return GetRandom ? m_RandomTypeID : m_RealTypeID; }
[[nodiscard]] uint32 GetInstanceID() const { return m_InstanceID; }
[[nodiscard]] BattlegroundStatus GetStatus() const { return m_Status; }
[[nodiscard]] uint32 GetClientInstanceID() const { return m_ClientInstanceID; }
[[nodiscard]] uint32 GetStartTime() const { return m_StartTime; }
[[nodiscard]] uint32 GetEndTime() const { return m_EndTime; }
[[nodiscard]] uint32 GetLastResurrectTime() const { return m_LastResurrectTime; }
uint32 GetMinLevel() const { return m_LevelMin; }
uint32 GetMaxLevel() const { return m_LevelMax; }
[[nodiscard]] uint32 GetMinLevel() const { return m_LevelMin; }
[[nodiscard]] uint32 GetMaxLevel() const { return m_LevelMax; }
uint32 GetMaxPlayersPerTeam() const { return m_MaxPlayersPerTeam; }
uint32 GetMinPlayersPerTeam() const { return m_MinPlayersPerTeam; }
[[nodiscard]] uint32 GetMaxPlayersPerTeam() const { return m_MaxPlayersPerTeam; }
[[nodiscard]] uint32 GetMinPlayersPerTeam() const { return m_MinPlayersPerTeam; }
int32 GetStartDelayTime() const { return m_StartDelayTime; }
uint8 GetArenaType() const { return m_ArenaType; }
TeamId GetWinner() const { return m_WinnerId; }
uint32 GetScriptId() const { return ScriptId; }
uint32 GetBonusHonorFromKill(uint32 kills) const;
[[nodiscard]] int32 GetStartDelayTime() const { return m_StartDelayTime; }
[[nodiscard]] uint8 GetArenaType() const { return m_ArenaType; }
[[nodiscard]] TeamId GetWinner() const { return m_WinnerId; }
[[nodiscard]] uint32 GetScriptId() const { return ScriptId; }
[[nodiscard]] uint32 GetBonusHonorFromKill(uint32 kills) const;
bool IsRandom() { return m_IsRandom; }
@@ -393,29 +393,29 @@ public:
void DecreaseInvitedCount(TeamId teamId) { if (m_BgInvitedPlayers[teamId]) --m_BgInvitedPlayers[teamId]; }
void IncreaseInvitedCount(TeamId teamId) { ++m_BgInvitedPlayers[teamId]; }
uint32 GetInvitedCount(TeamId teamId) const { return m_BgInvitedPlayers[teamId]; }
[[nodiscard]] uint32 GetInvitedCount(TeamId teamId) const { return m_BgInvitedPlayers[teamId]; }
bool HasFreeSlots() const;
uint32 GetFreeSlotsForTeam(TeamId teamId) const;
uint32 GetMaxFreeSlots() const;
[[nodiscard]] bool HasFreeSlots() const;
[[nodiscard]] uint32 GetFreeSlotsForTeam(TeamId teamId) const;
[[nodiscard]] uint32 GetMaxFreeSlots() const;
typedef std::set<Player*> SpectatorList;
typedef std::map<uint64, uint64> ToBeTeleportedMap;
void AddSpectator(Player* p) { m_Spectators.insert(p); }
void RemoveSpectator(Player* p) { m_Spectators.erase(p); }
bool HaveSpectators() { return !m_Spectators.empty(); }
const SpectatorList& GetSpectators() const { return m_Spectators; }
[[nodiscard]] const SpectatorList& GetSpectators() const { return m_Spectators; }
void AddToBeTeleported(uint64 spectator, uint64 participant) { m_ToBeTeleported[spectator] = participant; }
void RemoveToBeTeleported(uint64 spectator) { ToBeTeleportedMap::iterator itr = m_ToBeTeleported.find(spectator); if (itr != m_ToBeTeleported.end()) m_ToBeTeleported.erase(itr); }
void SpectatorsSendPacket(WorldPacket& data);
bool isArena() const { return m_IsArena; }
bool isBattleground() const { return !m_IsArena; }
bool isRated() const { return m_IsRated; }
[[nodiscard]] bool isArena() const { return m_IsArena; }
[[nodiscard]] bool isBattleground() const { return !m_IsArena; }
[[nodiscard]] bool isRated() const { return m_IsRated; }
typedef std::map<uint64, Player*> BattlegroundPlayerMap;
BattlegroundPlayerMap const& GetPlayers() const { return m_Players; }
uint32 GetPlayersSize() const { return m_Players.size(); }
[[nodiscard]] BattlegroundPlayerMap const& GetPlayers() const { return m_Players; }
[[nodiscard]] uint32 GetPlayersSize() const { return m_Players.size(); }
void ReadyMarkerClicked(Player* p); // pussywizard
std::set<uint32> readyMarkerClickedSet; // pussywizard
@@ -423,11 +423,11 @@ public:
typedef std::map<uint64, BattlegroundScore*> BattlegroundScoreMap;
typedef std::map<uint64, ArenaLogEntryData> ArenaLogEntryDataMap;// pussywizard
ArenaLogEntryDataMap ArenaLogEntries; // pussywizard
BattlegroundScoreMap::const_iterator GetPlayerScoresBegin() const { return PlayerScores.begin(); }
BattlegroundScoreMap::const_iterator GetPlayerScoresEnd() const { return PlayerScores.end(); }
uint32 GetPlayerScoresSize() const { return PlayerScores.size(); }
[[nodiscard]] BattlegroundScoreMap::const_iterator GetPlayerScoresBegin() const { return PlayerScores.begin(); }
[[nodiscard]] BattlegroundScoreMap::const_iterator GetPlayerScoresEnd() const { return PlayerScores.end(); }
[[nodiscard]] uint32 GetPlayerScoresSize() const { return PlayerScores.size(); }
uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); }
[[nodiscard]] uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); }
void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
void RemovePlayerFromResurrectQueue(Player* player);
@@ -442,12 +442,12 @@ public:
// Location
void SetMapId(uint32 MapID) { m_MapId = MapID; }
uint32 GetMapId() const { return m_MapId; }
[[nodiscard]] uint32 GetMapId() const { return m_MapId; }
// Map pointers
void SetBgMap(BattlegroundMap* map) { m_Map = map; }
BattlegroundMap* GetBgMap() const { ASSERT(m_Map); return m_Map; }
BattlegroundMap* FindBgMap() const { return m_Map; }
[[nodiscard]] BattlegroundMap* GetBgMap() const { ASSERT(m_Map); return m_Map; }
[[nodiscard]] BattlegroundMap* FindBgMap() const { return m_Map; }
void SetTeamStartLoc(TeamId teamId, float X, float Y, float Z, float O);
void GetTeamStartLoc(TeamId teamId, float& X, float& Y, float& Z, float& O) const
@@ -459,7 +459,7 @@ public:
}
void SetStartMaxDist(float startMaxDist) { m_StartMaxDist = startMaxDist; }
float GetStartMaxDist() const { return m_StartMaxDist; }
[[nodiscard]] float GetStartMaxDist() const { return m_StartMaxDist; }
// Packet Transfer
// method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!)
@@ -492,13 +492,13 @@ public:
void SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 strId1 = 0, uint32 strId2 = 0);
// Raid Group
Group* GetBgRaid(TeamId teamId) const { return m_BgRaids[teamId]; }
[[nodiscard]] Group* GetBgRaid(TeamId teamId) const { return m_BgRaids[teamId]; }
void SetBgRaid(TeamId teamId, Group* bg_raid);
virtual void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
uint32 GetPlayersCountByTeam(TeamId teamId) const { return m_PlayersCount[teamId]; }
uint32 GetAlivePlayersCountByTeam(TeamId teamId) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases
[[nodiscard]] uint32 GetPlayersCountByTeam(TeamId teamId) const { return m_PlayersCount[teamId]; }
[[nodiscard]] uint32 GetAlivePlayersCountByTeam(TeamId teamId) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases
void UpdatePlayersCountByTeam(TeamId teamId, bool remove)
{
if (remove)
@@ -509,11 +509,11 @@ public:
// used for rated arena battles
void SetArenaTeamIdForTeam(TeamId teamId, uint32 ArenaTeamId) { m_ArenaTeamIds[teamId] = ArenaTeamId; }
uint32 GetArenaTeamIdForTeam(TeamId teamId) const { return m_ArenaTeamIds[teamId]; }
[[nodiscard]] uint32 GetArenaTeamIdForTeam(TeamId teamId) const { return m_ArenaTeamIds[teamId]; }
void SetArenaTeamRatingChangeForTeam(TeamId teamId, int32 RatingChange) { m_ArenaTeamRatingChanges[teamId] = RatingChange; }
int32 GetArenaTeamRatingChangeForTeam(TeamId teamId) const { return m_ArenaTeamRatingChanges[teamId]; }
[[nodiscard]] int32 GetArenaTeamRatingChangeForTeam(TeamId teamId) const { return m_ArenaTeamRatingChanges[teamId]; }
void SetArenaMatchmakerRating(TeamId teamId, uint32 MMR) { m_ArenaTeamMMR[teamId] = MMR; }
uint32 GetArenaMatchmakerRating(TeamId teamId) const { return m_ArenaTeamMMR[teamId]; }
[[nodiscard]] uint32 GetArenaMatchmakerRating(TeamId teamId) const { return m_ArenaTeamMMR[teamId]; }
void CheckArenaAfterTimerConditions();
void CheckArenaWinConditions();
virtual void UpdateArenaWorldState();
@@ -571,54 +571,54 @@ public:
// since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
static TeamId GetOtherTeamId(TeamId teamId);
bool IsPlayerInBattleground(uint64 guid) const;
[[nodiscard]] bool IsPlayerInBattleground(uint64 guid) const;
bool ToBeDeleted() const { return m_SetDeleteThis; }
[[nodiscard]] bool ToBeDeleted() const { return m_SetDeleteThis; }
//void SetDeleteThis() { m_SetDeleteThis = true; }
void RewardXPAtKill(Player* killer, Player* victim);
virtual uint64 GetFlagPickerGUID(TeamId /*teamId*/ = TEAM_NEUTRAL) const { return 0; }
[[nodiscard]] virtual uint64 GetFlagPickerGUID(TeamId /*teamId*/ = TEAM_NEUTRAL) const { return 0; }
virtual void SetDroppedFlagGUID(uint64 /*guid*/, TeamId /*teamId*/ = TEAM_NEUTRAL) {}
uint32 GetTeamScore(TeamId teamId) const;
[[nodiscard]] uint32 GetTeamScore(TeamId teamId) const;
virtual TeamId GetPrematureWinner();
// because BattleGrounds with different types and same level range has different m_BracketId
uint8 GetUniqueBracketId() const;
[[nodiscard]] uint8 GetUniqueBracketId() const;
BattlegroundAV* ToBattlegroundAV() { if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast<BattlegroundAV*>(this); else return nullptr; }
BattlegroundAV const* ToBattlegroundAV() const { if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast<const BattlegroundAV*>(this); else return nullptr; }
[[nodiscard]] BattlegroundAV const* ToBattlegroundAV() const { if (GetBgTypeID(true) == BATTLEGROUND_AV) return reinterpret_cast<const BattlegroundAV*>(this); else return nullptr; }
BattlegroundWS* ToBattlegroundWS() { if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast<BattlegroundWS*>(this); else return nullptr; }
BattlegroundWS const* ToBattlegroundWS() const { if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast<const BattlegroundWS*>(this); else return nullptr; }
[[nodiscard]] BattlegroundWS const* ToBattlegroundWS() const { if (GetBgTypeID(true) == BATTLEGROUND_WS) return reinterpret_cast<const BattlegroundWS*>(this); else return nullptr; }
BattlegroundAB* ToBattlegroundAB() { if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast<BattlegroundAB*>(this); else return nullptr; }
BattlegroundAB const* ToBattlegroundAB() const { if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast<const BattlegroundAB*>(this); else return nullptr; }
[[nodiscard]] BattlegroundAB const* ToBattlegroundAB() const { if (GetBgTypeID(true) == BATTLEGROUND_AB) return reinterpret_cast<const BattlegroundAB*>(this); else return nullptr; }
BattlegroundNA* ToBattlegroundNA() { if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast<BattlegroundNA*>(this); else return nullptr; }
BattlegroundNA const* ToBattlegroundNA() const { if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast<const BattlegroundNA*>(this); else return nullptr; }
[[nodiscard]] BattlegroundNA const* ToBattlegroundNA() const { if (GetBgTypeID(true) == BATTLEGROUND_NA) return reinterpret_cast<const BattlegroundNA*>(this); else return nullptr; }
BattlegroundBE* ToBattlegroundBE() { if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast<BattlegroundBE*>(this); else return nullptr; }
BattlegroundBE const* ToBattlegroundBE() const { if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast<const BattlegroundBE*>(this); else return nullptr; }
[[nodiscard]] BattlegroundBE const* ToBattlegroundBE() const { if (GetBgTypeID(true) == BATTLEGROUND_BE) return reinterpret_cast<const BattlegroundBE*>(this); else return nullptr; }
BattlegroundEY* ToBattlegroundEY() { if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast<BattlegroundEY*>(this); else return nullptr; }
BattlegroundEY const* ToBattlegroundEY() const { if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast<const BattlegroundEY*>(this); else return nullptr; }
[[nodiscard]] BattlegroundEY const* ToBattlegroundEY() const { if (GetBgTypeID(true) == BATTLEGROUND_EY) return reinterpret_cast<const BattlegroundEY*>(this); else return nullptr; }
BattlegroundRL* ToBattlegroundRL() { if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast<BattlegroundRL*>(this); else return nullptr; }
BattlegroundRL const* ToBattlegroundRL() const { if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast<const BattlegroundRL*>(this); else return nullptr; }
[[nodiscard]] BattlegroundRL const* ToBattlegroundRL() const { if (GetBgTypeID(true) == BATTLEGROUND_RL) return reinterpret_cast<const BattlegroundRL*>(this); else return nullptr; }
BattlegroundSA* ToBattlegroundSA() { if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast<BattlegroundSA*>(this); else return nullptr; }
BattlegroundSA const* ToBattlegroundSA() const { if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast<const BattlegroundSA*>(this); else return nullptr; }
[[nodiscard]] BattlegroundSA const* ToBattlegroundSA() const { if (GetBgTypeID(true) == BATTLEGROUND_SA) return reinterpret_cast<const BattlegroundSA*>(this); else return nullptr; }
BattlegroundDS* ToBattlegroundDS() { if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast<BattlegroundDS*>(this); else return nullptr; }
BattlegroundDS const* ToBattlegroundDS() const { if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast<const BattlegroundDS*>(this); else return nullptr; }
[[nodiscard]] BattlegroundDS const* ToBattlegroundDS() const { if (GetBgTypeID(true) == BATTLEGROUND_DS) return reinterpret_cast<const BattlegroundDS*>(this); else return nullptr; }
BattlegroundRV* ToBattlegroundRV() { if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast<BattlegroundRV*>(this); else return nullptr; }
BattlegroundRV const* ToBattlegroundRV() const { if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast<const BattlegroundRV*>(this); else return nullptr; }
[[nodiscard]] BattlegroundRV const* ToBattlegroundRV() const { if (GetBgTypeID(true) == BATTLEGROUND_RV) return reinterpret_cast<const BattlegroundRV*>(this); else return nullptr; }
BattlegroundIC* ToBattlegroundIC() { if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast<BattlegroundIC*>(this); else return nullptr; }
BattlegroundIC const* ToBattlegroundIC() const { if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast<const BattlegroundIC*>(this); else return nullptr; }
[[nodiscard]] BattlegroundIC const* ToBattlegroundIC() const { if (GetBgTypeID(true) == BATTLEGROUND_IC) return reinterpret_cast<const BattlegroundIC*>(this); else return nullptr; }
protected:
// this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground

View File

@@ -45,9 +45,9 @@ public:
void addThreatPercent(int32 percent);
float getThreat() const { return iThreat; }
[[nodiscard]] float getThreat() const { return iThreat; }
bool isOnline() const { return iOnline; }
[[nodiscard]] bool isOnline() const { return iOnline; }
// used for temporary setting a threat and reducting it later again.
// the threat modification is stored
@@ -85,7 +85,7 @@ public:
//=================================================
uint64 getUnitGuid() const { return iUnitGuid; }
[[nodiscard]] uint64 getUnitGuid() const { return iUnitGuid; }
//=================================================
// reference is not needed anymore. realy delete it !
@@ -140,21 +140,21 @@ public:
void setDirty(bool isDirty) { iDirty = isDirty; }
bool isDirty() const { return iDirty; }
[[nodiscard]] bool isDirty() const { return iDirty; }
bool empty() const
[[nodiscard]] bool empty() const
{
return iThreatList.empty();
}
HostileReference* getMostHated() const
[[nodiscard]] HostileReference* getMostHated() const
{
return iThreatList.empty() ? NULL : iThreatList.front();
}
HostileReference* getReferenceByTarget(Unit* victim) const;
StorageType const& getThreatList() const { return iThreatList; }
[[nodiscard]] StorageType const& getThreatList() const { return iThreatList; }
private:
void remove(HostileReference* hostileRef)
@@ -199,16 +199,16 @@ public:
float getThreatWithoutTemp(Unit* victim, bool alsoSearchOfflineList = false);
bool isThreatListEmpty() const { return iThreatContainer.empty(); }
bool areThreatListsEmpty() const { return iThreatContainer.empty() && iThreatOfflineContainer.empty(); }
[[nodiscard]] bool isThreatListEmpty() const { return iThreatContainer.empty(); }
[[nodiscard]] bool areThreatListsEmpty() const { return iThreatContainer.empty() && iThreatOfflineContainer.empty(); }
void processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent);
bool isNeedUpdateToClient(uint32 time);
HostileReference* getCurrentVictim() const { return iCurrentVictim; }
[[nodiscard]] HostileReference* getCurrentVictim() const { return iCurrentVictim; }
Unit* GetOwner() const { return iOwner; }
[[nodiscard]] Unit* GetOwner() const { return iOwner; }
Unit* getHostilTarget();
@@ -243,8 +243,8 @@ public:
// methods to access the lists from the outside to do some dirty manipulation (scriping and such)
// I hope they are used as little as possible.
ThreatContainer::StorageType const& getThreatList() const { return iThreatContainer.getThreatList(); }
ThreatContainer::StorageType const& getOfflineThreatList() const { return iThreatOfflineContainer.getThreatList(); }
[[nodiscard]] ThreatContainer::StorageType const& getThreatList() const { return iThreatContainer.getThreatList(); }
[[nodiscard]] ThreatContainer::StorageType const& getOfflineThreatList() const { return iThreatOfflineContainer.getThreatList(); }
ThreatContainer& getOnlineContainer() { return iThreatContainer; }
ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; }
private:

View File

@@ -61,8 +61,8 @@ private:
uint32 iType;
public:
UnitBaseEvent(uint32 pType) { iType = pType; }
uint32 getType() const { return iType; }
bool matchesTypeMask(uint32 pMask) const { return iType & pMask; }
[[nodiscard]] uint32 getType() const { return iType; }
[[nodiscard]] bool matchesTypeMask(uint32 pMask) const { return iType & pMask; }
void setType(uint32 pType) { iType = pType; }
@@ -90,19 +90,19 @@ public:
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = pHostileReference; iBValue = pValue; }
int32 getIValue() const { return iIValue; }
[[nodiscard]] int32 getIValue() const { return iIValue; }
float getFValue() const { return iFValue; }
[[nodiscard]] float getFValue() const { return iFValue; }
bool getBValue() const { return iBValue; }
[[nodiscard]] bool getBValue() const { return iBValue; }
void setBValue(bool pValue) { iBValue = pValue; }
HostileReference* getReference() const { return iHostileReference; }
[[nodiscard]] HostileReference* getReference() const { return iHostileReference; }
void setThreatManager(ThreatManager* pThreatManager) { iThreatManager = pThreatManager; }
ThreatManager* getThreatManager() const { return iThreatManager; }
[[nodiscard]] ThreatManager* getThreatManager() const { return iThreatManager; }
};
//==============================================================
@@ -117,7 +117,7 @@ public:
void setThreatContainer(ThreatContainer* pThreatContainer) { iThreatContainer = pThreatContainer; }
ThreatContainer* getThreatContainer() const { return iThreatContainer; }
[[nodiscard]] ThreatContainer* getThreatContainer() const { return iThreatContainer; }
};
//==============================================================

View File

@@ -214,7 +214,7 @@ struct Condition
bool Meets(ConditionSourceInfo& sourceInfo);
uint32 GetSearcherTypeMaskForCondition();
bool isLoaded() const { return ConditionType > CONDITION_NONE || ReferenceId; }
[[nodiscard]] bool isLoaded() const { return ConditionType > CONDITION_NONE || ReferenceId; }
uint32 GetMaxAvailableConditionTargets();
};
@@ -244,8 +244,8 @@ public:
bool IsObjectMeetToConditions(WorldObject* object, ConditionList const& conditions);
bool IsObjectMeetToConditions(WorldObject* object1, WorldObject* object2, ConditionList const& conditions);
bool IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, ConditionList const& conditions);
bool CanHaveSourceGroupSet(ConditionSourceType sourceType) const;
bool CanHaveSourceIdSet(ConditionSourceType sourceType) const;
[[nodiscard]] bool CanHaveSourceGroupSet(ConditionSourceType sourceType) const;
[[nodiscard]] bool CanHaveSourceIdSet(ConditionSourceType sourceType) const;
ConditionList GetConditionsForNotGroupedEntry(ConditionSourceType sourceType, uint32 entry);
ConditionList GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId);
ConditionList GetConditionsForSmartEvent(int32 entryOrGuid, uint32 eventId, uint32 sourceType);

View File

@@ -51,19 +51,19 @@ public:
void DeleteFromDB(SQLTransaction& trans);
uint64 GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); }
[[nodiscard]] uint64 GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); }
time_t const& GetGhostTime() const { return m_time; }
[[nodiscard]] time_t const& GetGhostTime() const { return m_time; }
void ResetGhostTime() { m_time = time(nullptr); }
CorpseType GetType() const { return m_type; }
[[nodiscard]] CorpseType GetType() const { return m_type; }
GridCoord const& GetGridCoord() const { return _gridCoord; }
[[nodiscard]] GridCoord const& GetGridCoord() const { return _gridCoord; }
void SetGridCoord(GridCoord const& gridCoord) { _gridCoord = gridCoord; }
Loot loot; // remove insignia ONLY at BG
Player* lootRecipient;
bool IsExpired(time_t t) const;
[[nodiscard]] bool IsExpired(time_t t) const;
private:
CorpseType m_type;

View File

@@ -133,11 +133,11 @@ struct CreatureTemplate
uint32 flags_extra;
uint32 ScriptID;
WorldPacket queryData; // pussywizard
uint32 GetRandomValidModelId() const;
uint32 GetFirstValidModelId() const;
[[nodiscard]] uint32 GetRandomValidModelId() const;
[[nodiscard]] uint32 GetFirstValidModelId() const;
// helpers
SkillType GetRequiredLootSkill() const
[[nodiscard]] SkillType GetRequiredLootSkill() const
{
if (type_flags & CREATURE_TYPE_FLAG_HERB_SKINNING_SKILL)
return SKILL_HERBALISM;
@@ -149,12 +149,12 @@ struct CreatureTemplate
return SKILL_SKINNING; // normal case
}
bool IsExotic() const
[[nodiscard]] bool IsExotic() const
{
return (type_flags & CREATURE_TYPE_FLAG_EXOTIC_PET) != 0;
}
bool IsTameable(bool exotic) const
[[nodiscard]] bool IsTameable(bool exotic) const
{
if (type != CREATURE_TYPE_BEAST || family == 0 || (type_flags & CREATURE_TYPE_FLAG_TAMEABLE_PET) == 0)
return false;
@@ -351,21 +351,21 @@ struct VendorItemData
{
VendorItemList m_items;
VendorItem* GetItem(uint32 slot) const
[[nodiscard]] VendorItem* GetItem(uint32 slot) const
{
if (slot >= m_items.size())
return nullptr;
return m_items[slot];
}
bool Empty() const { return m_items.empty(); }
uint8 GetItemCount() const { return m_items.size(); }
[[nodiscard]] bool Empty() const { return m_items.empty(); }
[[nodiscard]] uint8 GetItemCount() const { return m_items.size(); }
void AddItem(uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost)
{
m_items.push_back(new VendorItem(item, maxcount, ptime, ExtendedCost));
}
bool RemoveItem(uint32 item_id);
VendorItem const* FindItemCostPair(uint32 item_id, uint32 extendedCost) const;
[[nodiscard]] VendorItem const* FindItemCostPair(uint32 item_id, uint32 extendedCost) const;
void Clear()
{
for (VendorItemList::const_iterator itr = m_items.begin(); itr != m_items.end(); ++itr)
@@ -402,7 +402,7 @@ struct TrainerSpell
uint32 learnedSpell[3];
// helpers
bool IsCastable() const { return learnedSpell[0] != spell; }
[[nodiscard]] bool IsCastable() const { return learnedSpell[0] != spell; }
};
typedef std::unordered_map<uint32 /*spellid*/, TrainerSpell> TrainerSpellMap;
@@ -415,7 +415,7 @@ struct TrainerSpellData
TrainerSpellMap spellList;
uint32 trainerType; // trainer type based at trainer spells, can be different from creature_template value.
// req. for correct show non-prof. trainers like weaponmaster, allowed values 0 and 2.
TrainerSpell const* Find(uint32 spell_id) const;
[[nodiscard]] TrainerSpell const* Find(uint32 spell_id) const;
};
typedef std::map<uint32, time_t> CreatureSpellCooldowns;
@@ -445,24 +445,24 @@ public:
void SelectLevel(bool changelevel = true);
void LoadEquipment(int8 id = 1, bool force = false);
uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
[[nodiscard]] uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
void Update(uint32 time) override; // overwrited Unit::Update
void GetRespawnPosition(float& x, float& y, float& z, float* ori = NULL, float* dist = NULL) const;
void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
uint32 GetCorpseDelay() const { return m_corpseDelay; }
bool IsRacialLeader() const { return GetCreatureTemplate()->RacialLeader; }
bool IsCivilian() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; }
bool IsTrigger() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER; }
bool IsGuard() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_GUARD; }
bool CanWalk() const { return GetCreatureTemplate()->InhabitType & INHABIT_GROUND; }
bool CanSwim() const override { return (GetCreatureTemplate()->InhabitType & INHABIT_WATER) || IS_PLAYER_GUID(GetOwnerGUID()); }
bool CanFly() const override { return GetCreatureTemplate()->InhabitType & INHABIT_AIR; }
[[nodiscard]] uint32 GetCorpseDelay() const { return m_corpseDelay; }
[[nodiscard]] bool IsRacialLeader() const { return GetCreatureTemplate()->RacialLeader; }
[[nodiscard]] bool IsCivilian() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; }
[[nodiscard]] bool IsTrigger() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER; }
[[nodiscard]] bool IsGuard() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_GUARD; }
[[nodiscard]] bool CanWalk() const { return GetCreatureTemplate()->InhabitType & INHABIT_GROUND; }
[[nodiscard]] bool CanSwim() const override { return (GetCreatureTemplate()->InhabitType & INHABIT_WATER) || IS_PLAYER_GUID(GetOwnerGUID()); }
[[nodiscard]] bool CanFly() const override { return GetCreatureTemplate()->InhabitType & INHABIT_AIR; }
void SetReactState(ReactStates st) { m_reactState = st; }
ReactStates GetReactState() const { return m_reactState; }
bool HasReactState(ReactStates state) const { return (m_reactState == state); }
[[nodiscard]] ReactStates GetReactState() const { return m_reactState; }
[[nodiscard]] bool HasReactState(ReactStates state) const { return (m_reactState == state); }
void InitializeReactState();
///// TODO RENAME THIS!!!!!
@@ -471,11 +471,11 @@ public:
bool CanCreatureAttack(Unit const* victim, bool skipDistCheck = false) const;
bool IsImmunedToSpell(SpellInfo const* spellInfo) override;
bool HasMechanicTemplateImmunity(uint32 mask) const;
[[nodiscard]] bool HasMechanicTemplateImmunity(uint32 mask) const;
// redefine Unit::IsImmunedToSpell
bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const override;
// redefine Unit::IsImmunedToSpellEffect
bool isElite() const
[[nodiscard]] bool isElite() const
{
if (IsPet())
return false;
@@ -484,7 +484,7 @@ public:
return rank != CREATURE_ELITE_NORMAL && rank != CREATURE_ELITE_RARE;
}
bool isWorldBoss() const
[[nodiscard]] bool isWorldBoss() const
{
if (IsPet())
return false;
@@ -492,19 +492,19 @@ public:
return GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_BOSS_MOB;
}
bool IsDungeonBoss() const;
bool IsImmuneToKnockback() const;
bool IsAvoidingAOE() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_AVOID_AOE; }
[[nodiscard]] bool IsDungeonBoss() const;
[[nodiscard]] bool IsImmuneToKnockback() const;
[[nodiscard]] bool IsAvoidingAOE() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_AVOID_AOE; }
uint8 getLevelForTarget(WorldObject const* target) const override; // overwrite Unit::getLevelForTarget for boss level support
bool IsInEvadeMode() const { return HasUnitState(UNIT_STATE_EVADE); }
bool IsEvadingAttacks() const { return IsInEvadeMode() || CanNotReachTarget(); }
[[nodiscard]] bool IsInEvadeMode() const { return HasUnitState(UNIT_STATE_EVADE); }
[[nodiscard]] bool IsEvadingAttacks() const { return IsInEvadeMode() || CanNotReachTarget(); }
bool AIM_Initialize(CreatureAI* ai = nullptr);
void Motion_Initialize();
CreatureAI* AI() const { return (CreatureAI*)i_AI; }
[[nodiscard]] CreatureAI* AI() const { return (CreatureAI*)i_AI; }
bool SetWalk(bool enable) override;
bool SetDisableGravity(bool disable, bool packetOnly = false) override;
@@ -514,22 +514,22 @@ public:
bool SetFeatherFall(bool enable, bool packetOnly = false) override;
bool SetHover(bool enable, bool packetOnly = false) override;
uint32 GetShieldBlockValue() const override
[[nodiscard]] uint32 GetShieldBlockValue() const override
{
return (getLevel() / 2 + uint32(GetStat(STAT_STRENGTH) / 20));
}
SpellSchoolMask GetMeleeDamageSchoolMask() const override { return m_meleeDamageSchoolMask; }
[[nodiscard]] SpellSchoolMask GetMeleeDamageSchoolMask() const override { return m_meleeDamageSchoolMask; }
void SetMeleeDamageSchool(SpellSchools school) { m_meleeDamageSchoolMask = SpellSchoolMask(1 << school); }
void _AddCreatureSpellCooldown(uint32 spell_id, uint32 end_time);
void AddSpellCooldown(uint32 spell_id, uint32 /*itemid*/, uint32 end_time, bool needSendToClient = false, bool forceSendToSpectator = false) override;
bool HasSpellCooldown(uint32 spell_id) const override;
uint32 GetSpellCooldown(uint32 spell_id) const;
[[nodiscard]] bool HasSpellCooldown(uint32 spell_id) const override;
[[nodiscard]] uint32 GetSpellCooldown(uint32 spell_id) const;
void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) override;
bool IsSpellProhibited(SpellSchoolMask idSchoolMask) const;
[[nodiscard]] bool IsSpellProhibited(SpellSchoolMask idSchoolMask) const;
bool HasSpell(uint32 spellID) const override;
[[nodiscard]] bool HasSpell(uint32 spellID) const override;
bool UpdateEntry(uint32 entry, const CreatureData* data = NULL, bool changelevel = true );
bool UpdateStats(Stats stat) override;
@@ -542,28 +542,28 @@ public:
void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage) override;
void SetCanDualWield(bool value) override;
int8 GetOriginalEquipmentId() const { return m_originalEquipmentId; }
[[nodiscard]] int8 GetOriginalEquipmentId() const { return m_originalEquipmentId; }
uint8 GetCurrentEquipmentId() { return m_equipmentId; }
void SetCurrentEquipmentId(uint8 id) { m_equipmentId = id; }
float GetSpellDamageMod(int32 Rank);
VendorItemData const* GetVendorItems() const;
[[nodiscard]] VendorItemData const* GetVendorItems() const;
uint32 GetVendorItemCurrentCount(VendorItem const* vItem);
uint32 UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 used_count);
TrainerSpellData const* GetTrainerSpells() const;
[[nodiscard]] TrainerSpellData const* GetTrainerSpells() const;
CreatureTemplate const* GetCreatureTemplate() const { return m_creatureInfo; }
CreatureData const* GetCreatureData() const { return m_creatureData; }
CreatureAddon const* GetCreatureAddon() const;
[[nodiscard]] CreatureTemplate const* GetCreatureTemplate() const { return m_creatureInfo; }
[[nodiscard]] CreatureData const* GetCreatureData() const { return m_creatureData; }
[[nodiscard]] CreatureAddon const* GetCreatureAddon() const;
std::string GetAIName() const;
std::string GetScriptName() const;
uint32 GetScriptId() const;
[[nodiscard]] std::string GetAIName() const;
[[nodiscard]] std::string GetScriptName() const;
[[nodiscard]] uint32 GetScriptId() const;
// override WorldObject function for proper name localization
std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const override;
[[nodiscard]] std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const override;
void setDeathState(DeathState s, bool despawn = false) override; // override virtual Unit::setDeathState
@@ -575,20 +575,20 @@ public:
virtual void DeleteFromDB(); // overriden in Pet
Loot loot;
uint64 GetLootRecipientGUID() const { return m_lootRecipient; }
Player* GetLootRecipient() const;
Group* GetLootRecipientGroup() const;
bool hasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
[[nodiscard]] uint64 GetLootRecipientGUID() const { return m_lootRecipient; }
[[nodiscard]] Player* GetLootRecipient() const;
[[nodiscard]] Group* GetLootRecipientGroup() const;
[[nodiscard]] bool hasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
bool isTappedBy(Player const* player) const; // return true if the creature is tapped by the player or a member of his party.
bool CanGeneratePickPocketLoot() const { return lootPickPocketRestoreTime == 0 || lootPickPocketRestoreTime < time(nullptr); }
[[nodiscard]] bool CanGeneratePickPocketLoot() const { return lootPickPocketRestoreTime == 0 || lootPickPocketRestoreTime < time(nullptr); }
void SetPickPocketLootTime() { lootPickPocketRestoreTime = time(nullptr) + MINUTE + GetCorpseDelay() + GetRespawnTime(); }
void ResetPickPocketLootTime() { lootPickPocketRestoreTime = 0; }
void SetLootRecipient (Unit* unit, bool withGroup = true);
void AllLootRemovedFromCorpse();
uint16 GetLootMode() const { return m_LootMode; }
bool HasLootMode(uint16 lootMode) const { return m_LootMode & lootMode; }
[[nodiscard]] uint16 GetLootMode() const { return m_LootMode; }
[[nodiscard]] bool HasLootMode(uint16 lootMode) const { return m_LootMode & lootMode; }
void SetLootMode(uint16 lootMode) { m_LootMode = lootMode; }
void AddLootMode(uint16 lootMode) { m_LootMode |= lootMode; }
void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
@@ -607,8 +607,8 @@ public:
void SendAIReaction(AiReaction reactionType);
Unit* SelectNearestTarget(float dist = 0, bool playerOnly = false) const;
Unit* SelectNearestTargetInAttackDistance(float dist) const;
[[nodiscard]] Unit* SelectNearestTarget(float dist = 0, bool playerOnly = false) const;
[[nodiscard]] Unit* SelectNearestTargetInAttackDistance(float dist) const;
void DoFleeToGetAssistance();
void CallForHelp(float fRadius);
@@ -625,23 +625,23 @@ public:
bool IsMoveInLineOfSightDisabled() { return m_moveInLineOfSightDisabled; }
bool IsMoveInLineOfSightStrictlyDisabled() { return m_moveInLineOfSightStrictlyDisabled; }
MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
[[nodiscard]] MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
void RemoveCorpse(bool setSpawnTime = true, bool skipVisibility = false);
void DespawnOrUnsummon(uint32 msTimeToDespawn = 0);
time_t const& GetRespawnTime() const { return m_respawnTime; }
time_t GetRespawnTimeEx() const;
[[nodiscard]] time_t const& GetRespawnTime() const { return m_respawnTime; }
[[nodiscard]] time_t GetRespawnTimeEx() const;
void SetRespawnTime(uint32 respawn) { m_respawnTime = respawn ? time(nullptr) + respawn : 0; }
void Respawn(bool force = false);
void SaveRespawnTime() override;
uint32 GetRespawnDelay() const { return m_respawnDelay; }
[[nodiscard]] uint32 GetRespawnDelay() const { return m_respawnDelay; }
void SetRespawnDelay(uint32 delay) { m_respawnDelay = delay; }
float GetWanderDistance() const { return m_wanderDistance; }
[[nodiscard]] float GetWanderDistance() const { return m_wanderDistance; }
void SetWanderDistance(float dist) { m_wanderDistance = dist; }
uint32 m_groupLootTimer; // (msecs)timer used for group loot
@@ -651,13 +651,13 @@ public:
void SetInCombatWithZone();
bool hasQuest(uint32 quest_id) const override;
bool hasInvolvedQuest(uint32 quest_id) const override;
[[nodiscard]] bool hasQuest(uint32 quest_id) const override;
[[nodiscard]] bool hasInvolvedQuest(uint32 quest_id) const override;
bool isRegeneratingHealth() { return m_regenHealth; }
void SetRegeneratingHealth(bool c) { m_regenHealth = c; }
virtual uint8 GetPetAutoSpellSize() const { return MAX_SPELL_CHARM; }
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
[[nodiscard]] virtual uint8 GetPetAutoSpellSize() const { return MAX_SPELL_CHARM; }
[[nodiscard]] virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
{
if (pos >= MAX_SPELL_CHARM || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED)
return 0;
@@ -666,7 +666,7 @@ public:
}
void SetCannotReachTarget(bool cannotReach) { if (cannotReach == m_cannotReachTarget) return; m_cannotReachTarget = cannotReach; m_cannotReachTimer = 0; }
bool CanNotReachTarget() const { return m_cannotReachTarget; }
[[nodiscard]] bool CanNotReachTarget() const { return m_cannotReachTarget; }
void SetPosition(float x, float y, float z, float o);
void SetPosition(const Position& pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); }
@@ -674,28 +674,28 @@ public:
void SetHomePosition(float x, float y, float z, float o) { m_homePosition.Relocate(x, y, z, o); }
void SetHomePosition(const Position& pos) { m_homePosition.Relocate(pos); }
void GetHomePosition(float& x, float& y, float& z, float& ori) const { m_homePosition.GetPosition(x, y, z, ori); }
Position const& GetHomePosition() const { return m_homePosition; }
[[nodiscard]] Position const& GetHomePosition() const { return m_homePosition; }
void SetTransportHomePosition(float x, float y, float z, float o) { m_transportHomePosition.Relocate(x, y, z, o); }
void SetTransportHomePosition(const Position& pos) { m_transportHomePosition.Relocate(pos); }
void GetTransportHomePosition(float& x, float& y, float& z, float& ori) const { m_transportHomePosition.GetPosition(x, y, z, ori); }
Position const& GetTransportHomePosition() const { return m_transportHomePosition; }
[[nodiscard]] Position const& GetTransportHomePosition() const { return m_transportHomePosition; }
uint32 GetWaypointPath() const { return m_path_id; }
[[nodiscard]] uint32 GetWaypointPath() const { return m_path_id; }
void LoadPath(uint32 pathid) { m_path_id = pathid; }
uint32 GetCurrentWaypointID() const { return m_waypointID; }
[[nodiscard]] uint32 GetCurrentWaypointID() const { return m_waypointID; }
void UpdateWaypointID(uint32 wpID) { m_waypointID = wpID; }
void SearchFormation();
CreatureGroup* GetFormation() const { return m_formation; }
[[nodiscard]] CreatureGroup* GetFormation() const { return m_formation; }
void SetFormation(CreatureGroup* formation) { m_formation = formation; }
Unit* SelectVictim();
void SetDisableReputationGain(bool disable) { DisableReputationGain = disable; }
bool IsReputationGainDisabled() const { return DisableReputationGain; }
bool IsDamageEnoughForLootingAndReward() const { return m_PlayerDamageReq == 0; }
[[nodiscard]] bool IsReputationGainDisabled() const { return DisableReputationGain; }
[[nodiscard]] bool IsDamageEnoughForLootingAndReward() const { return m_PlayerDamageReq == 0; }
void LowerPlayerDamageReq(uint32 unDamage)
{
if (m_PlayerDamageReq)
@@ -704,7 +704,7 @@ public:
void ResetPlayerDamageReq() { m_PlayerDamageReq = GetHealth() / 2; }
uint32 m_PlayerDamageReq;
uint32 GetOriginalEntry() const { return m_originalEntry; }
[[nodiscard]] uint32 GetOriginalEntry() const { return m_originalEntry; }
void SetOriginalEntry(uint32 entry) { m_originalEntry = entry; }
static float _GetDamageMod(int32 Rank);
@@ -719,7 +719,7 @@ public:
void ReleaseFocus(Spell const* focusSpell);
// Part of Evade mechanics
time_t GetLastDamagedTime() const { return _lastDamagedTime; }
[[nodiscard]] time_t GetLastDamagedTime() const { return _lastDamagedTime; }
void SetLastDamagedTime(time_t val) { _lastDamagedTime = val; }
protected:
@@ -772,7 +772,7 @@ protected:
uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
bool IsInvisibleDueToDespawn() const override;
[[nodiscard]] bool IsInvisibleDueToDespawn() const override;
bool CanAlwaysSee(WorldObject const* obj) const override;
private:

View File

@@ -155,23 +155,23 @@ public:
void AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action);
void SetMenuId(uint32 menu_id) { _menuId = menu_id; }
uint32 GetMenuId() const { return _menuId; }
[[nodiscard]] uint32 GetMenuId() const { return _menuId; }
void SetLocale(LocaleConstant locale) { _locale = locale; }
LocaleConstant GetLocale() const { return _locale; }
[[nodiscard]] LocaleConstant GetLocale() const { return _locale; }
void AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMenuId, uint32 gossipActionPoi);
uint32 GetMenuItemCount() const
[[nodiscard]] uint32 GetMenuItemCount() const
{
return _menuItems.size();
}
bool Empty() const
[[nodiscard]] bool Empty() const
{
return _menuItems.empty();
}
GossipMenuItem const* GetItem(uint32 id) const
[[nodiscard]] GossipMenuItem const* GetItem(uint32 id) const
{
GossipMenuItemContainer::const_iterator itr = _menuItems.find(id);
if (itr != _menuItems.end())
@@ -180,7 +180,7 @@ public:
return nullptr;
}
GossipMenuItemData const* GetItemData(uint32 indexId) const
[[nodiscard]] GossipMenuItemData const* GetItemData(uint32 indexId) const
{
GossipMenuItemDataContainer::const_iterator itr = _menuItemData.find(indexId);
if (itr != _menuItemData.end())
@@ -189,13 +189,13 @@ public:
return nullptr;
}
uint32 GetMenuItemSender(uint32 menuItemId) const;
uint32 GetMenuItemAction(uint32 menuItemId) const;
bool IsMenuItemCoded(uint32 menuItemId) const;
[[nodiscard]] uint32 GetMenuItemSender(uint32 menuItemId) const;
[[nodiscard]] uint32 GetMenuItemAction(uint32 menuItemId) const;
[[nodiscard]] bool IsMenuItemCoded(uint32 menuItemId) const;
void ClearMenu();
GossipMenuItemContainer const& GetMenuItems() const
[[nodiscard]] GossipMenuItemContainer const& GetMenuItems() const
{
return _menuItems;
}
@@ -216,19 +216,19 @@ public:
void AddMenuItem(uint32 QuestId, uint8 Icon);
void ClearMenu();
uint8 GetMenuItemCount() const
[[nodiscard]] uint8 GetMenuItemCount() const
{
return _questMenuItems.size();
}
bool Empty() const
[[nodiscard]] bool Empty() const
{
return _questMenuItems.empty();
}
bool HasItem(uint32 questId) const;
[[nodiscard]] bool HasItem(uint32 questId) const;
QuestMenuItem const& GetItem(uint16 index) const
[[nodiscard]] QuestMenuItem const& GetItem(uint16 index) const
{
return _questMenuItems[index];
}
@@ -246,12 +246,12 @@ public:
GossipMenu& GetGossipMenu() { return _gossipMenu; }
QuestMenu& GetQuestMenu() { return _questMenu; }
bool Empty() const { return _gossipMenu.Empty() && _questMenu.Empty(); }
[[nodiscard]] bool Empty() const { return _gossipMenu.Empty() && _questMenu.Empty(); }
void ClearMenus();
uint32 GetGossipOptionSender(uint32 selection) const { return _gossipMenu.GetMenuItemSender(selection); }
uint32 GetGossipOptionAction(uint32 selection) const { return _gossipMenu.GetMenuItemAction(selection); }
bool IsGossipOptionCoded(uint32 selection) const { return _gossipMenu.IsMenuItemCoded(selection); }
[[nodiscard]] uint32 GetGossipOptionSender(uint32 selection) const { return _gossipMenu.GetMenuItemSender(selection); }
[[nodiscard]] uint32 GetGossipOptionAction(uint32 selection) const { return _gossipMenu.GetMenuItemAction(selection); }
[[nodiscard]] bool IsGossipOptionCoded(uint32 selection) const { return _gossipMenu.IsMenuItemCoded(selection); }
void SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const;
void SendCloseGossip() const;

View File

@@ -37,7 +37,7 @@ public:
void RemoveFromWorld() override;
void SetTempSummonType(TempSummonType type);
void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) override {}
Unit* GetSummoner() const;
[[nodiscard]] Unit* GetSummoner() const;
uint64 GetSummonerGUID() { return m_summonerGUID; }
TempSummonType const& GetSummonType() { return m_type; }
uint32 GetTimer() { return m_timer; }
@@ -57,11 +57,11 @@ public:
Minion(SummonPropertiesEntry const* properties, uint64 owner, bool isWorldObject);
void InitStats(uint32 duration) override;
void RemoveFromWorld() override;
Unit* GetOwner() const;
float GetFollowAngle() const override { return m_followAngle; }
[[nodiscard]] Unit* GetOwner() const;
[[nodiscard]] float GetFollowAngle() const override { return m_followAngle; }
void SetFollowAngle(float angle) { m_followAngle = angle; }
bool IsPetGhoul() const {return GetEntry() == 26125 /*normal ghoul*/ || GetEntry() == 30230 /*Raise Ally ghoul*/;} // Ghoul may be guardian or pet
bool IsGuardianPet() const;
[[nodiscard]] bool IsPetGhoul() const {return GetEntry() == 26125 /*normal ghoul*/ || GetEntry() == 30230 /*Raise Ally ghoul*/;} // Ghoul may be guardian or pet
[[nodiscard]] bool IsGuardianPet() const;
void setDeathState(DeathState s, bool despawn = false) override; // override virtual Unit::setDeathState
protected:
const uint64 m_owner;
@@ -94,7 +94,7 @@ public:
void Update(uint32 time) override;
void RemoveFromWorld() override;
protected:
Player* GetOwner() const;
[[nodiscard]] Player* GetOwner() const;
const uint64 m_owner;
};

View File

@@ -35,19 +35,19 @@ public:
void Update(uint32 p_time) override;
void Remove();
void SetDuration(int32 newDuration);
int32 GetDuration() const;
[[nodiscard]] int32 GetDuration() const;
void Delay(int32 delaytime);
void SetAura(Aura* aura);
void RemoveAura();
void SetCasterViewpoint();
void RemoveCasterViewpoint();
Unit* GetCaster() const { return _caster; }
[[nodiscard]] Unit* GetCaster() const { return _caster; }
void BindToCaster();
void UnbindFromCaster();
uint32 GetSpellId() const { return GetUInt32Value(DYNAMICOBJECT_SPELLID); }
uint64 GetCasterGUID() const { return GetUInt64Value(DYNAMICOBJECT_CASTER); }
float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); }
bool IsViewpoint() const { return _isViewpoint; }
[[nodiscard]] uint32 GetSpellId() const { return GetUInt32Value(DYNAMICOBJECT_SPELLID); }
[[nodiscard]] uint64 GetCasterGUID() const { return GetUInt64Value(DYNAMICOBJECT_CASTER); }
[[nodiscard]] float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); }
[[nodiscard]] bool IsViewpoint() const { return _isViewpoint; }
protected:
Aura* _aura;

View File

@@ -392,7 +392,7 @@ struct GameObjectTemplate
bool IsForQuests; // pussywizard
// helpers
bool IsDespawnAtAction() const
[[nodiscard]] bool IsDespawnAtAction() const
{
switch (type)
{
@@ -405,7 +405,7 @@ struct GameObjectTemplate
}
}
bool IsUsableMounted() const
[[nodiscard]] bool IsUsableMounted() const
{
switch (type)
{
@@ -422,7 +422,7 @@ struct GameObjectTemplate
}
}
uint32 GetLockId() const
[[nodiscard]] uint32 GetLockId() const
{
switch (type)
{
@@ -453,7 +453,7 @@ struct GameObjectTemplate
}
}
bool GetDespawnPossibility() const // despawn at targeting of cast?
[[nodiscard]] bool GetDespawnPossibility() const // despawn at targeting of cast?
{
switch (type)
{
@@ -474,7 +474,7 @@ struct GameObjectTemplate
}
}
uint32 GetCharges() const // despawn at uses amount
[[nodiscard]] uint32 GetCharges() const // despawn at uses amount
{
switch (type)
{
@@ -488,7 +488,7 @@ struct GameObjectTemplate
}
}
uint32 GetLinkedGameObjectEntry() const
[[nodiscard]] uint32 GetLinkedGameObjectEntry() const
{
switch (type)
{
@@ -503,7 +503,7 @@ struct GameObjectTemplate
}
}
uint32 GetAutoCloseTime() const
[[nodiscard]] uint32 GetAutoCloseTime() const
{
uint32 autoCloseTime = 0;
switch (type)
@@ -532,7 +532,7 @@ struct GameObjectTemplate
return autoCloseTime /* xinef: changed to milliseconds/ IN_MILLISECONDS*/; // prior to 3.0.3, conversion was / 0x10000;
}
uint32 GetLootId() const
[[nodiscard]] uint32 GetLootId() const
{
switch (type)
{
@@ -545,7 +545,7 @@ struct GameObjectTemplate
}
}
uint32 GetGossipMenuId() const
[[nodiscard]] uint32 GetGossipMenuId() const
{
switch (type)
{
@@ -558,7 +558,7 @@ struct GameObjectTemplate
}
}
uint32 GetEventScriptId() const
[[nodiscard]] uint32 GetEventScriptId() const
{
switch (type)
{
@@ -573,7 +573,7 @@ struct GameObjectTemplate
}
}
uint32 GetCooldown() const // Cooldown preventing goober and traps to cast spell
[[nodiscard]] uint32 GetCooldown() const // Cooldown preventing goober and traps to cast spell
{
switch (type)
{
@@ -586,7 +586,7 @@ struct GameObjectTemplate
}
}
bool IsLargeGameObject() const
[[nodiscard]] bool IsLargeGameObject() const
{
switch (type)
{
@@ -611,7 +611,7 @@ struct GameObjectTemplate
}
}
bool IsGameObjectForQuests() const
[[nodiscard]] bool IsGameObjectForQuests() const
{
return IsForQuests;
}
@@ -741,24 +741,24 @@ public:
virtual bool Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0);
void Update(uint32 p_time) override;
GameObjectTemplate const* GetGOInfo() const { return m_goInfo; }
GameObjectTemplateAddon const* GetTemplateAddon() const;
GameObjectData const* GetGOData() const { return m_goData; }
GameObjectValue const* GetGOValue() const { return &m_goValue; }
[[nodiscard]] GameObjectTemplate const* GetGOInfo() const { return m_goInfo; }
[[nodiscard]] GameObjectTemplateAddon const* GetTemplateAddon() const;
[[nodiscard]] GameObjectData const* GetGOData() const { return m_goData; }
[[nodiscard]] GameObjectValue const* GetGOValue() const { return &m_goValue; }
bool IsTransport() const;
bool IsDestructibleBuilding() const;
[[nodiscard]] bool IsTransport() const;
[[nodiscard]] bool IsDestructibleBuilding() const;
uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
[[nodiscard]] uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
// z_rot, y_rot, x_rot - rotation angles around z, y and x axes
void SetWorldRotationAngles(float z_rot, float y_rot, float x_rot);
void SetWorldRotation(G3D::Quat const& rot);
void SetTransportPathRotation(float qx, float qy, float qz, float qw);
int64 GetPackedWorldRotation() const { return m_packedRotation; }
[[nodiscard]] int64 GetPackedWorldRotation() const { return m_packedRotation; }
// overwrite WorldObject function for proper name localization
std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const override;
[[nodiscard]] std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const override;
void SaveToDB();
void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
@@ -776,18 +776,18 @@ public:
m_spawnedByDefault = false; // all object with owner is despawned after delay
SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner);
}
uint64 GetOwnerGUID() const { return GetUInt64Value(OBJECT_FIELD_CREATED_BY); }
Unit* GetOwner() const;
[[nodiscard]] uint64 GetOwnerGUID() const { return GetUInt64Value(OBJECT_FIELD_CREATED_BY); }
[[nodiscard]] Unit* GetOwner() const;
void SetSpellId(uint32 id)
{
m_spawnedByDefault = false; // all summoned object is despawned after delay
m_spellId = id;
}
uint32 GetSpellId() const { return m_spellId;}
[[nodiscard]] uint32 GetSpellId() const { return m_spellId;}
time_t GetRespawnTime() const { return m_respawnTime; }
time_t GetRespawnTimeEx() const
[[nodiscard]] time_t GetRespawnTime() const { return m_respawnTime; }
[[nodiscard]] time_t GetRespawnTimeEx() const
{
time_t now = time(nullptr);
if (m_respawnTime > now)
@@ -802,26 +802,26 @@ public:
m_respawnDelayTime = respawn > 0 ? respawn : 0;
}
void Respawn();
bool isSpawned() const
[[nodiscard]] bool isSpawned() const
{
return m_respawnDelayTime == 0 ||
(m_respawnTime > 0 && !m_spawnedByDefault) ||
(m_respawnTime == 0 && m_spawnedByDefault);
}
bool isSpawnedByDefault() const { return m_spawnedByDefault; }
[[nodiscard]] bool isSpawnedByDefault() const { return m_spawnedByDefault; }
void SetSpawnedByDefault(bool b) { m_spawnedByDefault = b; }
uint32 GetRespawnDelay() const { return m_respawnDelayTime; }
[[nodiscard]] uint32 GetRespawnDelay() const { return m_respawnDelayTime; }
void Refresh();
void Delete();
void getFishLoot(Loot* loot, Player* loot_owner);
void getFishLootJunk(Loot* loot, Player* loot_owner);
GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); }
[[nodiscard]] GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); }
void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); }
GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); }
[[nodiscard]] GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); }
void SetGoState(GOState state);
uint8 GetGoArtKit() const { return GetByteValue(GAMEOBJECT_BYTES_1, 2); }
[[nodiscard]] uint8 GetGoArtKit() const { return GetByteValue(GAMEOBJECT_BYTES_1, 2); }
void SetGoArtKit(uint8 artkit);
uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); }
[[nodiscard]] uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); }
void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); }
static void SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid = 0);
@@ -830,19 +830,19 @@ public:
void Use(Unit* user);
LootState getLootState() const { return m_lootState; }
[[nodiscard]] LootState getLootState() const { return m_lootState; }
// Note: unit is only used when s = GO_ACTIVATED
void SetLootState(LootState s, Unit* unit = nullptr);
uint16 GetLootMode() const { return m_LootMode; }
bool HasLootMode(uint16 lootMode) const { return m_LootMode & lootMode; }
[[nodiscard]] uint16 GetLootMode() const { return m_LootMode; }
[[nodiscard]] bool HasLootMode(uint16 lootMode) const { return m_LootMode & lootMode; }
void SetLootMode(uint16 lootMode) { m_LootMode = lootMode; }
void AddLootMode(uint16 lootMode) { m_LootMode |= lootMode; }
void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
void ResetLootMode() { m_LootMode = LOOT_MODE_DEFAULT; }
void AddToSkillupList(uint32 PlayerGuidLow) { m_SkillupList.push_back(PlayerGuidLow); }
bool IsInSkillupList(uint32 PlayerGuidLow) const
[[nodiscard]] bool IsInSkillupList(uint32 PlayerGuidLow) const
{
for (std::list<uint32>::const_iterator i = m_SkillupList.begin(); i != m_SkillupList.end(); ++i)
if (*i == PlayerGuidLow)
@@ -855,25 +855,25 @@ public:
void AddUniqueUse(Player* player);
void AddUse() { ++m_usetimes; }
uint32 GetUseCount() const { return m_usetimes; }
uint32 GetUniqueUseCount() const { return m_unique_users.size(); }
[[nodiscard]] uint32 GetUseCount() const { return m_usetimes; }
[[nodiscard]] uint32 GetUniqueUseCount() const { return m_unique_users.size(); }
void SaveRespawnTime() override;
Loot loot;
Player* GetLootRecipient() const;
Group* GetLootRecipientGroup() const;
[[nodiscard]] Player* GetLootRecipient() const;
[[nodiscard]] Group* GetLootRecipientGroup() const;
void SetLootRecipient(Unit* unit);
bool IsLootAllowedFor(Player const* player) const;
bool HasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
[[nodiscard]] bool HasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
uint32 m_groupLootTimer; // (msecs)timer used for group loot
uint32 lootingGroupLowGUID; // used to find group which is looting
void SetLootGenerationTime() { m_lootGenerationTime = time(nullptr); }
uint32 GetLootGenerationTime() const { return m_lootGenerationTime; }
[[nodiscard]] uint32 GetLootGenerationTime() const { return m_lootGenerationTime; }
bool hasQuest(uint32 quest_id) const override;
bool hasInvolvedQuest(uint32 quest_id) const override;
[[nodiscard]] bool hasQuest(uint32 quest_id) const override;
[[nodiscard]] bool hasInvolvedQuest(uint32 quest_id) const override;
bool ActivateToQuest(Player* target) const;
void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false, Unit* user = nullptr);
// 0 = use `gameobject`.`spawntimesecs`
@@ -881,9 +881,9 @@ public:
void TriggeringLinkedGameObject(uint32 trapEntry, Unit* target);
bool IsNeverVisible() const override;
[[nodiscard]] bool IsNeverVisible() const override;
bool IsAlwaysVisibleFor(WorldObject const* seer) const override;
bool IsInvisibleDueToDespawn() const override;
[[nodiscard]] bool IsInvisibleDueToDespawn() const override;
uint8 getLevelForTarget(WorldObject const* target) const override
{
@@ -897,7 +897,7 @@ public:
void CastSpell(Unit* target, uint32 spell);
void SendCustomAnim(uint32 anim);
bool IsInRange(float x, float y, float z, float radius) const;
[[nodiscard]] bool IsInRange(float x, float y, float z, float radius) const;
void SendMessageToSetInRange(WorldPacket* data, float dist, bool /*self*/, bool includeMargin = false, Player const* skipped_rcvr = nullptr) override; // pussywizard!
@@ -905,7 +905,7 @@ public:
void SetDestructibleBuildingModifyState(bool allow) { m_allowModifyDestructibleBuilding = allow; }
// sets GameObject type 33 destruction flags and optionally default health for that state
void SetDestructibleState(GameObjectDestructibleState state, Player* eventInvoker = NULL, bool setHealth = false);
GameObjectDestructibleState GetDestructibleState() const
[[nodiscard]] GameObjectDestructibleState GetDestructibleState() const
{
if (HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED))
return GO_DESTRUCTIBLE_DESTROYED;
@@ -916,12 +916,12 @@ public:
void EventInform(uint32 eventId);
virtual uint32 GetScriptId() const { return GetGOInfo()->ScriptId; }
GameObjectAI* AI() const { return m_AI; }
[[nodiscard]] virtual uint32 GetScriptId() const { return GetGOInfo()->ScriptId; }
[[nodiscard]] GameObjectAI* AI() const { return m_AI; }
std::string GetAIName() const;
[[nodiscard]] std::string GetAIName() const;
void SetDisplayId(uint32 displayid);
uint32 GetDisplayId() const { return GetUInt32Value(GAMEOBJECT_DISPLAYID); }
[[nodiscard]] uint32 GetDisplayId() const { return GetUInt32Value(GAMEOBJECT_DISPLAYID); }
GameObjectModel* m_model;
void GetRespawnPosition(float& x, float& y, float& z, float* ori = nullptr) const;
@@ -929,22 +929,22 @@ public:
void SetPosition(float x, float y, float z, float o);
void SetPosition(const Position& pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); }
bool IsStaticTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT; }
bool IsMotionTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT; }
[[nodiscard]] bool IsStaticTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT; }
[[nodiscard]] bool IsMotionTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT; }
Transport* ToTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<Transport*>(this); else return nullptr; }
Transport const* ToTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<Transport const*>(this); else return nullptr; }
[[nodiscard]] Transport const* ToTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<Transport const*>(this); else return nullptr; }
StaticTransport* ToStaticTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<StaticTransport*>(this); else return nullptr; }
StaticTransport const* ToStaticTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<StaticTransport const*>(this); else return nullptr; }
[[nodiscard]] StaticTransport const* ToStaticTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast<StaticTransport const*>(this); else return nullptr; }
MotionTransport* ToMotionTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast<MotionTransport*>(this); else return nullptr; }
MotionTransport const* ToMotionTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast<MotionTransport const*>(this); else return nullptr; }
[[nodiscard]] MotionTransport const* ToMotionTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT) return reinterpret_cast<MotionTransport const*>(this); else return nullptr; }
float GetStationaryX() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionX(); return GetPositionX(); }
float GetStationaryY() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionY(); return GetPositionY(); }
float GetStationaryZ() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionZ(); return GetPositionZ(); }
float GetStationaryO() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetOrientation(); return GetOrientation(); }
[[nodiscard]] float GetStationaryX() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionX(); return GetPositionX(); }
[[nodiscard]] float GetStationaryY() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionY(); return GetPositionY(); }
[[nodiscard]] float GetStationaryZ() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionZ(); return GetPositionZ(); }
[[nodiscard]] float GetStationaryO() const override { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetOrientation(); return GetOrientation(); }
float GetInteractionDistance();

View File

@@ -29,14 +29,14 @@ public:
void StoreItem(uint8 slot, Item* pItem, bool update);
void RemoveItem(uint8 slot, bool update);
Item* GetItemByPos(uint8 slot) const;
[[nodiscard]] Item* GetItemByPos(uint8 slot) const;
uint32 GetItemCount(uint32 item, Item* eItem = nullptr) const;
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = nullptr) const;
uint8 GetSlotByItemGUID(uint64 guid) const;
bool IsEmpty() const;
uint32 GetFreeSlots() const;
uint32 GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); }
[[nodiscard]] uint8 GetSlotByItemGUID(uint64 guid) const;
[[nodiscard]] bool IsEmpty() const;
[[nodiscard]] uint32 GetFreeSlots() const;
[[nodiscard]] uint32 GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); }
// DB operations
// overwrite virtual Item::SaveToDB

View File

@@ -203,18 +203,18 @@ public:
virtual bool Create(uint32 guidlow, uint32 itemid, Player const* owner);
ItemTemplate const* GetTemplate() const;
[[nodiscard]] ItemTemplate const* GetTemplate() const;
uint64 GetOwnerGUID() const { return GetUInt64Value(ITEM_FIELD_OWNER); }
[[nodiscard]] uint64 GetOwnerGUID() const { return GetUInt64Value(ITEM_FIELD_OWNER); }
void SetOwnerGUID(uint64 guid) { SetUInt64Value(ITEM_FIELD_OWNER, guid); }
Player* GetOwner() const;
[[nodiscard]] Player* GetOwner() const;
void SetBinding(bool val) { ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_SOULBOUND, val); }
bool IsSoulBound() const { return HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_SOULBOUND); }
bool IsBoundAccountWide() const { return (GetTemplate()->Flags & ITEM_FLAG_IS_BOUND_TO_ACCOUNT) != 0; }
[[nodiscard]] bool IsSoulBound() const { return HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_SOULBOUND); }
[[nodiscard]] bool IsBoundAccountWide() const { return (GetTemplate()->Flags & ITEM_FLAG_IS_BOUND_TO_ACCOUNT) != 0; }
bool IsBindedNotWith(Player const* player) const;
bool IsBoundByEnchant() const;
bool IsBoundByTempEnchant() const;
[[nodiscard]] bool IsBoundByEnchant() const;
[[nodiscard]] bool IsBoundByTempEnchant() const;
virtual void SaveToDB(SQLTransaction& trans);
virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry);
static void DeleteFromDB(SQLTransaction& trans, uint32 itemGuid);
@@ -225,49 +225,49 @@ public:
void DeleteRefundDataFromDB(SQLTransaction* trans);
Bag* ToBag() { if (IsBag()) return reinterpret_cast<Bag*>(this); else return nullptr; }
const Bag* ToBag() const { if (IsBag()) return reinterpret_cast<const Bag*>(this); else return nullptr; }
[[nodiscard]] const Bag* ToBag() const { if (IsBag()) return reinterpret_cast<const Bag*>(this); else return nullptr; }
bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_UNLOCKED); }
bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; }
bool IsCurrencyToken() const { return GetTemplate()->IsCurrencyToken(); }
bool IsNotEmptyBag() const;
bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; }
bool CanBeTraded(bool mail = false, bool trade = false) const;
[[nodiscard]] bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_UNLOCKED); }
[[nodiscard]] bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; }
[[nodiscard]] bool IsCurrencyToken() const { return GetTemplate()->IsCurrencyToken(); }
[[nodiscard]] bool IsNotEmptyBag() const;
[[nodiscard]] bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; }
[[nodiscard]] bool CanBeTraded(bool mail = false, bool trade = false) const;
void SetInTrade(bool b = true) { mb_in_trade = b; }
bool IsInTrade() const { return mb_in_trade; }
[[nodiscard]] bool IsInTrade() const { return mb_in_trade; }
bool HasEnchantRequiredSkill(const Player* player) const;
uint32 GetEnchantRequiredLevel() const;
[[nodiscard]] uint32 GetEnchantRequiredLevel() const;
bool IsFitToSpellRequirements(SpellInfo const* spellInfo) const;
bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const;
bool GemsFitSockets() const;
[[nodiscard]] bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const;
[[nodiscard]] bool GemsFitSockets() const;
uint32 GetCount() const { return GetUInt32Value(ITEM_FIELD_STACK_COUNT); }
[[nodiscard]] uint32 GetCount() const { return GetUInt32Value(ITEM_FIELD_STACK_COUNT); }
void SetCount(uint32 value) { SetUInt32Value(ITEM_FIELD_STACK_COUNT, value); }
uint32 GetMaxStackCount() const { return GetTemplate()->GetMaxStackSize(); }
[[nodiscard]] uint32 GetMaxStackCount() const { return GetTemplate()->GetMaxStackSize(); }
// Checks if this item has sockets, whether built-in or added by an upgrade.
bool HasSocket() const;
uint8 GetGemCountWithID(uint32 GemID) const;
uint8 GetGemCountWithLimitCategory(uint32 limitCategory) const;
[[nodiscard]] bool HasSocket() const;
[[nodiscard]] uint8 GetGemCountWithID(uint32 GemID) const;
[[nodiscard]] uint8 GetGemCountWithLimitCategory(uint32 limitCategory) const;
InventoryResult CanBeMergedPartlyWith(ItemTemplate const* proto) const;
uint8 GetSlot() const {return m_slot;}
[[nodiscard]] uint8 GetSlot() const {return m_slot;}
Bag* GetContainer() { return m_container; }
uint8 GetBagSlot() const;
[[nodiscard]] uint8 GetBagSlot() const;
void SetSlot(uint8 slot) { m_slot = slot; }
uint16 GetPos() const { return uint16(GetBagSlot()) << 8 | GetSlot(); }
[[nodiscard]] uint16 GetPos() const { return uint16(GetBagSlot()) << 8 | GetSlot(); }
void SetContainer(Bag* container) { m_container = container; }
bool IsInBag() const { return m_container != nullptr; }
bool IsEquipped() const;
[[nodiscard]] bool IsInBag() const { return m_container != nullptr; }
[[nodiscard]] bool IsEquipped() const;
uint32 GetSkill();
uint32 GetSpell();
// RandomPropertyId (signed but stored as unsigned)
int32 GetItemRandomPropertyId() const { return GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID); }
uint32 GetItemSuffixFactor() const { return GetUInt32Value(ITEM_FIELD_PROPERTY_SEED); }
[[nodiscard]] int32 GetItemRandomPropertyId() const { return GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID); }
[[nodiscard]] uint32 GetItemSuffixFactor() const { return GetUInt32Value(ITEM_FIELD_PROPERTY_SEED); }
void SetItemRandomProperties(int32 randomPropId);
void UpdateItemSuffixFactor();
static int32 GenerateItemRandomPropertyId(uint32 item_id);
@@ -275,11 +275,11 @@ public:
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner);
void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges);
void ClearEnchantment(EnchantmentSlot slot);
uint32 GetEnchantmentId(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET);}
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET);}
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET);}
[[nodiscard]] uint32 GetEnchantmentId(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET);}
[[nodiscard]] uint32 GetEnchantmentDuration(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET);}
[[nodiscard]] uint32 GetEnchantmentCharges(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET);}
std::string const& GetText() const { return m_text; }
[[nodiscard]] std::string const& GetText() const { return m_text; }
void SetText(std::string const& text) { m_text = text; }
void SendUpdateSockets();
@@ -288,30 +288,30 @@ public:
void UpdateDuration(Player* owner, uint32 diff);
// spell charges (signed but stored as unsigned)
int32 GetSpellCharges(uint8 index/*0..5*/ = 0) const { return GetInt32Value(ITEM_FIELD_SPELL_CHARGES + index); }
[[nodiscard]] int32 GetSpellCharges(uint8 index/*0..5*/ = 0) const { return GetInt32Value(ITEM_FIELD_SPELL_CHARGES + index); }
void SetSpellCharges(uint8 index/*0..5*/, int32 value) { SetInt32Value(ITEM_FIELD_SPELL_CHARGES + index, value); }
Loot loot;
bool m_lootGenerated;
// Update States
ItemUpdateState GetState() const { return uState; }
[[nodiscard]] ItemUpdateState GetState() const { return uState; }
void SetState(ItemUpdateState state, Player* forplayer = nullptr);
void AddToUpdateQueueOf(Player* player);
void RemoveFromUpdateQueueOf(Player* player);
bool IsInUpdateQueue() const { return uQueuePos != -1; }
uint32 GetQueuePos() const { return uQueuePos; }
[[nodiscard]] bool IsInUpdateQueue() const { return uQueuePos != -1; }
[[nodiscard]] uint32 GetQueuePos() const { return uQueuePos; }
void FSetState(ItemUpdateState state) // forced
{
uState = state;
}
bool hasQuest(uint32 quest_id) const override { return GetTemplate()->StartQuest == quest_id; }
bool hasInvolvedQuest(uint32 /*quest_id*/) const override { return false; }
bool IsPotion() const { return GetTemplate()->IsPotion(); }
bool IsWeaponVellum() const { return GetTemplate()->IsWeaponVellum(); }
bool IsArmorVellum() const { return GetTemplate()->IsArmorVellum(); }
bool IsConjuredConsumable() const { return GetTemplate()->IsConjuredConsumable(); }
[[nodiscard]] bool hasQuest(uint32 quest_id) const override { return GetTemplate()->StartQuest == quest_id; }
[[nodiscard]] bool hasInvolvedQuest(uint32 /*quest_id*/) const override { return false; }
[[nodiscard]] bool IsPotion() const { return GetTemplate()->IsPotion(); }
[[nodiscard]] bool IsWeaponVellum() const { return GetTemplate()->IsWeaponVellum(); }
[[nodiscard]] bool IsArmorVellum() const { return GetTemplate()->IsArmorVellum(); }
[[nodiscard]] bool IsConjuredConsumable() const { return GetTemplate()->IsConjuredConsumable(); }
// Item Refund system
void SetNotRefundable(Player* owner, bool changestate = true, SQLTransaction* trans = nullptr);
@@ -333,7 +333,7 @@ public:
void BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet&) override;
uint32 GetScriptId() const { return GetTemplate()->ScriptId; }
[[nodiscard]] uint32 GetScriptId() const { return GetTemplate()->ScriptId; }
private:
std::string m_text;
uint8 m_slot;

View File

@@ -692,7 +692,7 @@ struct ItemTemplate
WorldPacket queryData; // pussywizard
// helpers
bool HasSignature() const
[[nodiscard]] bool HasSignature() const
{
return GetMaxStackSize() == 1 &&
Class != ITEM_CLASS_CONSUMABLE &&
@@ -701,7 +701,7 @@ struct ItemTemplate
ItemId != 6948; /*Hearthstone*/
}
bool CanChangeEquipStateInCombat() const
[[nodiscard]] bool CanChangeEquipStateInCombat() const
{
switch (InventoryType)
{
@@ -721,14 +721,14 @@ struct ItemTemplate
return false;
}
bool IsCurrencyToken() const { return BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS; }
[[nodiscard]] bool IsCurrencyToken() const { return BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS; }
uint32 GetMaxStackSize() const
[[nodiscard]] uint32 GetMaxStackSize() const
{
return (Stackable == 2147483647 || Stackable <= 0) ? uint32(0x7FFFFFFF - 1) : uint32(Stackable);
}
float getDPS() const
[[nodiscard]] float getDPS() const
{
if (Delay == 0)
return 0;
@@ -738,7 +738,7 @@ struct ItemTemplate
return temp * 500 / Delay;
}
int32 getFeralBonus(int32 extraDPS = 0) const
[[nodiscard]] int32 getFeralBonus(int32 extraDPS = 0) const
{
// 0x02A5F3 - is mask for Melee weapon from ItemSubClassMask.dbc
if (Class == ITEM_CLASS_WEAPON && (1 << SubClass) & 0x02A5F3)
@@ -751,7 +751,7 @@ struct ItemTemplate
return 0;
}
float GetItemLevelIncludingQuality(uint8 pLevel) const
[[nodiscard]] float GetItemLevelIncludingQuality(uint8 pLevel) const
{
auto itemLevel = (float)ItemLevel;
switch (Quality)
@@ -776,7 +776,7 @@ struct ItemTemplate
return std::max<float>(0.f, itemLevel);
}
uint32 GetSkill() const
[[nodiscard]] uint32 GetSkill() const
{
const static uint32 item_weapon_skills[MAX_ITEM_SUBCLASS_WEAPON] =
{
@@ -811,10 +811,10 @@ struct ItemTemplate
}
}
bool IsPotion() const { return Class == ITEM_CLASS_CONSUMABLE && SubClass == ITEM_SUBCLASS_POTION; }
bool IsWeaponVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_WEAPON_ENCHANTMENT; }
bool IsArmorVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_ARMOR_ENCHANTMENT; }
bool IsConjuredConsumable() const { return Class == ITEM_CLASS_CONSUMABLE && (Flags & ITEM_FLAG_CONJURED); }
[[nodiscard]] bool IsPotion() const { return Class == ITEM_CLASS_CONSUMABLE && SubClass == ITEM_SUBCLASS_POTION; }
[[nodiscard]] bool IsWeaponVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_WEAPON_ENCHANTMENT; }
[[nodiscard]] bool IsArmorVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_ARMOR_ENCHANTMENT; }
[[nodiscard]] bool IsConjuredConsumable() const { return Class == ITEM_CLASS_CONSUMABLE && (Flags & ITEM_FLAG_CONJURED); }
void InitializeQueryData();
};

View File

@@ -125,23 +125,23 @@ class Object
public:
virtual ~Object();
bool IsInWorld() const { return m_inWorld; }
[[nodiscard]] bool IsInWorld() const { return m_inWorld; }
virtual void AddToWorld();
virtual void RemoveFromWorld();
uint64 GetGUID() const { return GetUInt64Value(0); }
uint32 GetGUIDLow() const { return GUID_LOPART(GetUInt64Value(0)); }
uint32 GetGUIDMid() const { return GUID_ENPART(GetUInt64Value(0)); }
uint32 GetGUIDHigh() const { return GUID_HIPART(GetUInt64Value(0)); }
const ByteBuffer& GetPackGUID() const { return m_PackGUID; }
uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
[[nodiscard]] uint64 GetGUID() const { return GetUInt64Value(0); }
[[nodiscard]] uint32 GetGUIDLow() const { return GUID_LOPART(GetUInt64Value(0)); }
[[nodiscard]] uint32 GetGUIDMid() const { return GUID_ENPART(GetUInt64Value(0)); }
[[nodiscard]] uint32 GetGUIDHigh() const { return GUID_HIPART(GetUInt64Value(0)); }
[[nodiscard]] const ByteBuffer& GetPackGUID() const { return m_PackGUID; }
[[nodiscard]] uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); }
virtual void SetObjectScale(float scale) { SetFloatValue(OBJECT_FIELD_SCALE_X, scale); }
TypeID GetTypeId() const { return m_objectTypeId; }
bool isType(uint16 mask) const { return (mask & m_objectType); }
[[nodiscard]] TypeID GetTypeId() const { return m_objectTypeId; }
[[nodiscard]] bool isType(uint16 mask) const { return (mask & m_objectType); }
virtual void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const;
void SendUpdateToPlayer(Player* player);
@@ -152,38 +152,38 @@ public:
virtual void DestroyForPlayer(Player* target, bool onDeath = false) const;
int32 GetInt32Value(uint16 index) const
[[nodiscard]] int32 GetInt32Value(uint16 index) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
return m_int32Values[index];
}
uint32 GetUInt32Value(uint16 index) const
[[nodiscard]] uint32 GetUInt32Value(uint16 index) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
return m_uint32Values[index];
}
uint64 GetUInt64Value(uint16 index) const
[[nodiscard]] uint64 GetUInt64Value(uint16 index) const
{
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, false));
return *((uint64*) & (m_uint32Values[index]));
}
float GetFloatValue(uint16 index) const
[[nodiscard]] float GetFloatValue(uint16 index) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
return m_floatValues[index];
}
uint8 GetByteValue(uint16 index, uint8 offset) const
[[nodiscard]] uint8 GetByteValue(uint16 index, uint8 offset) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
ASSERT(offset < 4);
return *(((uint8*)&m_uint32Values[index]) + offset);
}
uint16 GetUInt16Value(uint16 index, uint8 offset) const
[[nodiscard]] uint16 GetUInt16Value(uint16 index, uint8 offset) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
ASSERT(offset < 2);
@@ -228,7 +228,7 @@ public:
SetFlag(index, flag);
}
bool HasFlag(uint16 index, uint32 flag) const
[[nodiscard]] bool HasFlag(uint16 index, uint32 flag) const
{
if (index >= m_valuesCount && !PrintIndexError(index, false))
return false;
@@ -247,7 +247,7 @@ public:
SetByteFlag(index, offset, flag);
}
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
[[nodiscard]] bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
ASSERT(offset < 4);
@@ -282,7 +282,7 @@ public:
SetFlag64(index, flag);
}
bool HasFlag64(uint16 index, uint64 flag) const
[[nodiscard]] bool HasFlag64(uint16 index, uint64 flag) const
{
ASSERT(index < m_valuesCount || PrintIndexError(index, false));
return (GetUInt64Value(index) & flag) != 0;
@@ -296,10 +296,10 @@ public:
void ClearUpdateMask(bool remove);
uint16 GetValuesCount() const { return m_valuesCount; }
[[nodiscard]] uint16 GetValuesCount() const { return m_valuesCount; }
virtual bool hasQuest(uint32 /* quest_id */) const { return false; }
virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; }
[[nodiscard]] virtual bool hasQuest(uint32 /* quest_id */) const { return false; }
[[nodiscard]] virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; }
virtual void BuildUpdate(UpdateDataMapType&, UpdatePlayerSet&) {}
void BuildFieldsUpdate(Player*, UpdateDataMapType&) const;
@@ -310,20 +310,20 @@ public:
void ForceValuesUpdateAtIndex(uint32);
Player* ToPlayer() { if (GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Player*>(this); else return nullptr; }
Player const* ToPlayer() const { if (GetTypeId() == TYPEID_PLAYER) return (Player const*)((Player*)this); else return nullptr; }
[[nodiscard]] Player const* ToPlayer() const { if (GetTypeId() == TYPEID_PLAYER) return (Player const*)((Player*)this); else return nullptr; }
Creature* ToCreature() { if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature*>(this); else return nullptr; }
Creature const* ToCreature() const { if (GetTypeId() == TYPEID_UNIT) return (Creature const*)((Creature*)this); else return nullptr; }
[[nodiscard]] Creature const* ToCreature() const { if (GetTypeId() == TYPEID_UNIT) return (Creature const*)((Creature*)this); else return nullptr; }
Unit* ToUnit() { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Unit*>(this); else return nullptr; }
Unit const* ToUnit() const { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return (const Unit*)((Unit*)this); else return nullptr; }
[[nodiscard]] Unit const* ToUnit() const { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return (const Unit*)((Unit*)this); else return nullptr; }
GameObject* ToGameObject() { if (GetTypeId() == TYPEID_GAMEOBJECT) return reinterpret_cast<GameObject*>(this); else return nullptr; }
GameObject const* ToGameObject() const { if (GetTypeId() == TYPEID_GAMEOBJECT) return (const GameObject*)((GameObject*)this); else return nullptr; }
[[nodiscard]] GameObject const* ToGameObject() const { if (GetTypeId() == TYPEID_GAMEOBJECT) return (const GameObject*)((GameObject*)this); else return nullptr; }
Corpse* ToCorpse() { if (GetTypeId() == TYPEID_CORPSE) return reinterpret_cast<Corpse*>(this); else return nullptr; }
Corpse const* ToCorpse() const { if (GetTypeId() == TYPEID_CORPSE) return (const Corpse*)((Corpse*)this); else return nullptr; }
[[nodiscard]] Corpse const* ToCorpse() const { if (GetTypeId() == TYPEID_CORPSE) return (const Corpse*)((Corpse*)this); else return nullptr; }
DynamicObject* ToDynObject() { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast<DynamicObject*>(this); else return nullptr; }
DynamicObject const* ToDynObject() const { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast<DynamicObject const*>(this); else return nullptr; }
[[nodiscard]] DynamicObject const* ToDynObject() const { if (GetTypeId() == TYPEID_DYNAMICOBJECT) return reinterpret_cast<DynamicObject const*>(this); else return nullptr; }
DataMap CustomData;
@@ -333,7 +333,7 @@ protected:
void _InitValues();
void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh);
std::string _ConcatFields(uint16 startIndex, uint16 size) const;
[[nodiscard]] std::string _ConcatFields(uint16 startIndex, uint16 size) const;
void _LoadIntoDataField(std::string const& data, uint32 startOffset, uint32 count);
uint32 GetUpdateFieldData(Player const* target, uint32*& flags) const;
@@ -367,7 +367,7 @@ private:
ByteBuffer m_PackGUID;
// for output helpfull error messages from asserts
bool PrintIndexError(uint32 index, bool set) const;
[[nodiscard]] bool PrintIndexError(uint32 index, bool set) const;
Object(const Object&); // prevent generation copy constructor
Object& operator=(Object const&); // prevent generation assigment operator
};
@@ -454,10 +454,10 @@ struct Position
m_orientation = orientation;
}
float GetPositionX() const { return m_positionX; }
float GetPositionY() const { return m_positionY; }
float GetPositionZ() const { return m_positionZ; }
float GetOrientation() const { return m_orientation; }
[[nodiscard]] float GetPositionX() const { return m_positionX; }
[[nodiscard]] float GetPositionY() const { return m_positionY; }
[[nodiscard]] float GetPositionZ() const { return m_positionZ; }
[[nodiscard]] float GetOrientation() const { return m_orientation; }
void GetPosition(float& x, float& y) const
{
@@ -483,7 +483,7 @@ struct Position
pos->Relocate(m_positionX, m_positionY, m_positionZ, m_orientation);
}
Position GetPosition() const { return *this; }
[[nodiscard]] Position GetPosition() const { return *this; }
Position::PositionXYZStreamer PositionXYZStream()
@@ -495,15 +495,15 @@ struct Position
return PositionXYZOStreamer(*this);
}
bool IsPositionValid() const;
[[nodiscard]] bool IsPositionValid() const;
float GetExactDist2dSq(float x, float y) const
[[nodiscard]] float GetExactDist2dSq(float x, float y) const
{
float dx = m_positionX - x;
float dy = m_positionY - y;
return dx * dx + dy * dy;
}
float GetExactDist2d(const float x, const float y) const
[[nodiscard]] float GetExactDist2d(const float x, const float y) const
{
return sqrt(GetExactDist2dSq(x, y));
}
@@ -517,12 +517,12 @@ struct Position
{
return sqrt(GetExactDist2dSq(pos));
}
float GetExactDistSq(float x, float y, float z) const
[[nodiscard]] float GetExactDistSq(float x, float y, float z) const
{
float dz = m_positionZ - z;
return GetExactDist2dSq(x, y) + dz * dz;
}
float GetExactDist(float x, float y, float z) const
[[nodiscard]] float GetExactDist(float x, float y, float z) const
{
return sqrt(GetExactDistSq(x, y, z));
}
@@ -541,15 +541,15 @@ struct Position
void GetPositionOffsetTo(const Position& endPos, Position& retOffset) const;
float GetAngle(const Position* pos) const;
float GetAngle(float x, float y) const;
[[nodiscard]] float GetAngle(float x, float y) const;
float GetRelativeAngle(const Position* pos) const
{
return GetAngle(pos) - m_orientation;
}
float GetRelativeAngle(float x, float y) const { return GetAngle(x, y) - m_orientation; }
[[nodiscard]] float GetRelativeAngle(float x, float y) const { return GetAngle(x, y) - m_orientation; }
void GetSinCos(float x, float y, float& vsin, float& vcos) const;
bool IsInDist2d(float x, float y, float dist) const
[[nodiscard]] bool IsInDist2d(float x, float y, float dist) const
{
return GetExactDist2dSq(x, y) < dist * dist;
}
@@ -557,7 +557,7 @@ struct Position
{
return GetExactDist2dSq(pos) < dist * dist;
}
bool IsInDist(float x, float y, float z, float dist) const
[[nodiscard]] bool IsInDist(float x, float y, float z, float dist) const
{
return GetExactDistSq(x, y, z) < dist * dist;
}
@@ -566,10 +566,10 @@ struct Position
return GetExactDistSq(pos) < dist * dist;
}
bool IsWithinBox(const Position& center, float xradius, float yradius, float zradius) const;
[[nodiscard]] bool IsWithinBox(const Position& center, float xradius, float yradius, float zradius) const;
bool HasInArc(float arcangle, const Position* pos, float targetRadius = 0.0f) const;
bool HasInLine(WorldObject const* target, float width) const;
std::string ToString() const;
[[nodiscard]] std::string ToString() const;
// modulos a radian orientation to the range of 0..2PI
static float NormalizeOrientation(float o)
@@ -651,15 +651,15 @@ struct MovementInfo
jump.Reset();
}
uint32 GetMovementFlags() const { return flags; }
[[nodiscard]] uint32 GetMovementFlags() const { return flags; }
void SetMovementFlags(uint32 flag) { flags = flag; }
void AddMovementFlag(uint32 flag) { flags |= flag; }
void RemoveMovementFlag(uint32 flag) { flags &= ~flag; }
bool HasMovementFlag(uint32 flag) const { return flags & flag; }
[[nodiscard]] bool HasMovementFlag(uint32 flag) const { return flags & flag; }
uint16 GetExtraMovementFlags() const { return flags2; }
[[nodiscard]] uint16 GetExtraMovementFlags() const { return flags2; }
void AddExtraMovementFlag(uint16 flag) { flags2 |= flag; }
bool HasExtraMovementFlag(uint16 flag) const { return flags2 & flag; }
[[nodiscard]] bool HasExtraMovementFlag(uint16 flag) const { return flags2 & flag; }
void SetFallTime(uint32 time) { fallTime = time; }
@@ -687,12 +687,12 @@ public:
Relocate(loc);
}
uint32 GetMapId() const
[[nodiscard]] uint32 GetMapId() const
{
return m_mapId;
}
WorldLocation GetWorldLocation() const
[[nodiscard]] WorldLocation GetWorldLocation() const
{
return *this;
}
@@ -704,7 +704,7 @@ template<class T>
class GridObject
{
public:
bool IsInGrid() const { return _gridRef.isValid(); }
[[nodiscard]] bool IsInGrid() const { return _gridRef.isValid(); }
void AddToGrid(GridRefManager<T>& m) { ASSERT(!IsInGrid()); _gridRef.link(&m, (T*)this); }
void RemoveFromGrid() { ASSERT(IsInGrid()); _gridRef.unlink(); }
private:
@@ -721,12 +721,12 @@ public:
m_flags = 0;
}
T_FLAGS GetFlags() const { return m_flags; }
bool HasFlag(FLAG_TYPE flag) const { return m_flags & (1 << flag); }
[[nodiscard]] T_FLAGS GetFlags() const { return m_flags; }
[[nodiscard]] bool HasFlag(FLAG_TYPE flag) const { return m_flags & (1 << flag); }
void AddFlag(FLAG_TYPE flag) { m_flags |= (1 << flag); }
void DelFlag(FLAG_TYPE flag) { m_flags &= ~(1 << flag); }
T_VALUES GetValue(FLAG_TYPE flag) const { return m_values[flag]; }
[[nodiscard]] T_VALUES GetValue(FLAG_TYPE flag) const { return m_values[flag]; }
void SetValue(FLAG_TYPE flag, T_VALUES value) { m_values[flag] = value; }
void AddValue(FLAG_TYPE flag, T_VALUES value) { m_values[flag] += value; }
@@ -752,7 +752,7 @@ protected:
MovableMapObject() : _moveState(MAP_OBJECT_CELL_MOVE_NONE) {}
private:
Cell const& GetCurrentCell() const { return _currentCell; }
[[nodiscard]] Cell const& GetCurrentCell() const { return _currentCell; }
void SetCurrentCell(Cell const& cell) { _currentCell = cell; }
Cell _currentCell;
@@ -818,12 +818,12 @@ public:
void GetContactPoint(const WorldObject* obj, float& x, float& y, float& z, float distance2d = CONTACT_DISTANCE) const;
void GetChargeContactPoint(const WorldObject* obj, float& x, float& y, float& z, float distance2d = CONTACT_DISTANCE) const;
float GetObjectSize() const
[[nodiscard]] float GetObjectSize() const
{
return (m_valuesCount > UNIT_FIELD_COMBATREACH) ? m_floatValues[UNIT_FIELD_COMBATREACH] : DEFAULT_WORLD_OBJECT_SIZE;
}
virtual float GetCombatReach() const { return 0.0f; } // overridden (only) in Unit
[[nodiscard]] virtual float GetCombatReach() const { return 0.0f; } // overridden (only) in Unit
void UpdateGroundPositionZ(float x, float y, float& z) const;
void UpdateAllowedPositionZ(float x, float y, float& z) const;
@@ -835,35 +835,35 @@ public:
pos.Relocate(x, y, z, GetOrientation());
}
uint32 GetInstanceId() const { return m_InstanceId; }
[[nodiscard]] uint32 GetInstanceId() const { return m_InstanceId; }
virtual void SetPhaseMask(uint32 newPhaseMask, bool update);
uint32 GetPhaseMask() const { return m_phaseMask; }
[[nodiscard]] uint32 GetPhaseMask() const { return m_phaseMask; }
bool InSamePhase(WorldObject const* obj) const { return InSamePhase(obj->GetPhaseMask()); }
bool InSamePhase(uint32 phasemask) const { return m_useCombinedPhases ? GetPhaseMask() & phasemask : GetPhaseMask() == phasemask; }
[[nodiscard]] bool InSamePhase(uint32 phasemask) const { return m_useCombinedPhases ? GetPhaseMask() & phasemask : GetPhaseMask() == phasemask; }
virtual uint32 GetZoneId(bool forceRecalc = false) const;
virtual uint32 GetAreaId(bool forceRecalc = false) const;
[[nodiscard]] virtual uint32 GetZoneId(bool forceRecalc = false) const;
[[nodiscard]] virtual uint32 GetAreaId(bool forceRecalc = false) const;
virtual void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, bool forceRecalc = false) const;
InstanceScript* GetInstanceScript();
std::string const& GetName() const { return m_name; }
[[nodiscard]] std::string const& GetName() const { return m_name; }
void SetName(std::string const& newname) { m_name = newname; }
virtual std::string const& GetNameForLocaleIdx(LocaleConstant /*locale_idx*/) const { return m_name; }
[[nodiscard]] virtual std::string const& GetNameForLocaleIdx(LocaleConstant /*locale_idx*/) const { return m_name; }
float GetDistance(const WorldObject* obj) const
{
float d = GetExactDist(obj) - GetObjectSize() - obj->GetObjectSize();
return d > 0.0f ? d : 0.0f;
}
float GetDistance(const Position& pos) const
[[nodiscard]] float GetDistance(const Position& pos) const
{
float d = GetExactDist(&pos) - GetObjectSize();
return d > 0.0f ? d : 0.0f;
}
float GetDistance(float x, float y, float z) const
[[nodiscard]] float GetDistance(float x, float y, float z) const
{
float d = GetExactDist(x, y, z) - GetObjectSize();
return d > 0.0f ? d : 0.0f;
@@ -873,7 +873,7 @@ public:
float d = GetExactDist2d(obj) - GetObjectSize() - obj->GetObjectSize();
return d > 0.0f ? d : 0.0f;
}
float GetDistance2d(float x, float y) const
[[nodiscard]] float GetDistance2d(float x, float y) const
{
float d = GetExactDist2d(x, y) - GetObjectSize();
return d > 0.0f ? d : 0.0f;
@@ -892,11 +892,11 @@ public:
return IsInWorld() && obj->IsInWorld() && (FindMap() == obj->FindMap());
return false;
}
bool IsWithinDist3d(float x, float y, float z, float dist) const
[[nodiscard]] bool IsWithinDist3d(float x, float y, float z, float dist) const
{ return IsInDist(x, y, z, dist + GetObjectSize()); }
bool IsWithinDist3d(const Position* pos, float dist) const
{ return IsInDist(pos, dist + GetObjectSize()); }
bool IsWithinDist2d(float x, float y, float dist) const
[[nodiscard]] bool IsWithinDist2d(float x, float y, float dist) const
{ return IsInDist2d(x, y, dist + GetObjectSize()); }
bool IsWithinDist2d(const Position* pos, float dist) const
{ return IsInDist2d(pos, dist + GetObjectSize()); }
@@ -909,14 +909,14 @@ public:
{
return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D);
}
bool IsWithinLOS(float x, float y, float z, LineOfSightChecks checks = LINEOFSIGHT_ALL_CHECKS) const;
[[nodiscard]] bool IsWithinLOS(float x, float y, float z, LineOfSightChecks checks = LINEOFSIGHT_ALL_CHECKS) const;
bool IsWithinLOSInMap(WorldObject const* obj, LineOfSightChecks checks = LINEOFSIGHT_ALL_CHECKS) const;
Position GetHitSpherePointFor(Position const& dest) const;
[[nodiscard]] Position GetHitSpherePointFor(Position const& dest) const;
void GetHitSpherePointFor(Position const& dest, float& x, float& y, float& z) const;
bool GetDistanceOrder(WorldObject const* obj1, WorldObject const* obj2, bool is3D = true) const;
bool IsInRange(WorldObject const* obj, float minRange, float maxRange, bool is3D = true) const;
bool IsInRange2d(float x, float y, float minRange, float maxRange) const;
bool IsInRange3d(float x, float y, float z, float minRange, float maxRange) const;
[[nodiscard]] bool IsInRange2d(float x, float y, float minRange, float maxRange) const;
[[nodiscard]] bool IsInRange3d(float x, float y, float z, float minRange, float maxRange) const;
bool isInFront(WorldObject const* target, float arc = M_PI) const;
bool isInBack(WorldObject const* target, float arc = M_PI) const;
@@ -948,8 +948,8 @@ public:
virtual void SaveRespawnTime() {}
void AddObjectToRemoveList();
float GetGridActivationRange() const;
float GetVisibilityRange() const;
[[nodiscard]] float GetGridActivationRange() const;
[[nodiscard]] float GetVisibilityRange() const;
float GetSightRange(const WorldObject* target = nullptr) const;
//bool CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth = false, bool distanceCheck = false) const;
bool CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth = false, bool distanceCheck = false, bool checkAlert = false) const;
@@ -969,15 +969,15 @@ public:
virtual void SetMap(Map* map);
virtual void ResetMap();
Map* GetMap() const { ASSERT(m_currMap); return m_currMap; }
Map* FindMap() const { return m_currMap; }
[[nodiscard]] Map* GetMap() const { ASSERT(m_currMap); return m_currMap; }
[[nodiscard]] Map* FindMap() const { return m_currMap; }
//used to check all object's GetMap() calls when object is not in world!
//this function should be removed in nearest time...
Map const* GetBaseMap() const;
[[nodiscard]] Map const* GetBaseMap() const;
void SetZoneScript();
ZoneScript* GetZoneScript() const { return m_zoneScript; }
[[nodiscard]] ZoneScript* GetZoneScript() const { return m_zoneScript; }
TempSummon* SummonCreature(uint32 id, const Position& pos, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, uint32 vehId = 0, SummonPropertiesEntry const* properties = nullptr) const;
TempSummon* SummonCreature(uint32 id, float x, float y, float z, float ang = 0, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, SummonPropertiesEntry const* properties = nullptr)
@@ -995,11 +995,11 @@ public:
Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, bool setLevel = false, CreatureAI * (*GetAI)(Creature*) = nullptr);
void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = nullptr);
Creature* FindNearestCreature(uint32 entry, float range, bool alive = true) const;
GameObject* FindNearestGameObject(uint32 entry, float range) const;
GameObject* FindNearestGameObjectOfType(GameobjectTypes type, float range) const;
[[nodiscard]] Creature* FindNearestCreature(uint32 entry, float range, bool alive = true) const;
[[nodiscard]] GameObject* FindNearestGameObject(uint32 entry, float range) const;
[[nodiscard]] GameObject* FindNearestGameObjectOfType(GameobjectTypes type, float range) const;
Player* SelectNearestPlayer(float distance = 0) const;
[[nodiscard]] Player* SelectNearestPlayer(float distance = 0) const;
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
@@ -1011,25 +1011,25 @@ public:
//relocation and visibility system functions
void AddToNotify(uint16 f);
void RemoveFromNotify(uint16 f) { m_notifyflags &= ~f; }
bool isNeedNotify(uint16 f) const { return m_notifyflags & f;}
uint16 GetNotifyFlags() const { return m_notifyflags; }
bool NotifyExecuted(uint16 f) const { return m_executed_notifies & f;}
[[nodiscard]] bool isNeedNotify(uint16 f) const { return m_notifyflags & f;}
[[nodiscard]] uint16 GetNotifyFlags() const { return m_notifyflags; }
[[nodiscard]] bool NotifyExecuted(uint16 f) const { return m_executed_notifies & f;}
void SetNotified(uint16 f) { m_executed_notifies |= f;}
void ResetAllNotifies() { m_notifyflags = 0; m_executed_notifies = 0; }
bool isActiveObject() const { return m_isActive; }
[[nodiscard]] bool isActiveObject() const { return m_isActive; }
void setActive(bool isActiveObject);
bool IsVisibilityOverridden() const { return m_isVisibilityDistanceOverride; }
[[nodiscard]] bool IsVisibilityOverridden() const { return m_isVisibilityDistanceOverride; }
void SetVisibilityDistanceOverride(bool isVisibilityDistanceOverride);
void SetWorldObject(bool apply);
bool IsPermanentWorldObject() const { return m_isWorldObject; }
bool IsWorldObject() const;
[[nodiscard]] bool IsPermanentWorldObject() const { return m_isWorldObject; }
[[nodiscard]] bool IsWorldObject() const;
template<class NOTIFIER> void VisitNearbyObject(float const& radius, NOTIFIER& notifier) const { if (IsInWorld()) GetMap()->VisitAll(GetPositionX(), GetPositionY(), radius, notifier); }
template<class NOTIFIER> void VisitNearbyGridObject(float const& radius, NOTIFIER& notifier) const { if (IsInWorld()) GetMap()->VisitGrid(GetPositionX(), GetPositionY(), radius, notifier); }
template<class NOTIFIER> void VisitNearbyWorldObject(float const& radius, NOTIFIER& notifier) const { if (IsInWorld()) GetMap()->VisitWorld(GetPositionX(), GetPositionY(), radius, notifier); }
bool IsInWintergrasp() const
[[nodiscard]] bool IsInWintergrasp() const
{
return GetMapId() == 571 && GetPositionX() > 3733.33331f && GetPositionX() < 5866.66663f && GetPositionY() > 1599.99999f && GetPositionY() < 4799.99997f;
}
@@ -1045,22 +1045,22 @@ public:
uint32 LastUsedScriptID;
// Transports
Transport* GetTransport() const { return m_transport; }
float GetTransOffsetX() const { return m_movementInfo.transport.pos.GetPositionX(); }
float GetTransOffsetY() const { return m_movementInfo.transport.pos.GetPositionY(); }
float GetTransOffsetZ() const { return m_movementInfo.transport.pos.GetPositionZ(); }
float GetTransOffsetO() const { return m_movementInfo.transport.pos.GetOrientation(); }
uint32 GetTransTime() const { return m_movementInfo.transport.time; }
int8 GetTransSeat() const { return m_movementInfo.transport.seat; }
virtual uint64 GetTransGUID() const;
[[nodiscard]] Transport* GetTransport() const { return m_transport; }
[[nodiscard]] float GetTransOffsetX() const { return m_movementInfo.transport.pos.GetPositionX(); }
[[nodiscard]] float GetTransOffsetY() const { return m_movementInfo.transport.pos.GetPositionY(); }
[[nodiscard]] float GetTransOffsetZ() const { return m_movementInfo.transport.pos.GetPositionZ(); }
[[nodiscard]] float GetTransOffsetO() const { return m_movementInfo.transport.pos.GetOrientation(); }
[[nodiscard]] uint32 GetTransTime() const { return m_movementInfo.transport.time; }
[[nodiscard]] int8 GetTransSeat() const { return m_movementInfo.transport.seat; }
[[nodiscard]] virtual uint64 GetTransGUID() const;
void SetTransport(Transport* t) { m_transport = t; }
MovementInfo m_movementInfo;
virtual float GetStationaryX() const { return GetPositionX(); }
virtual float GetStationaryY() const { return GetPositionY(); }
virtual float GetStationaryZ() const { return GetPositionZ(); }
virtual float GetStationaryO() const { return GetOrientation(); }
[[nodiscard]] virtual float GetStationaryX() const { return GetPositionX(); }
[[nodiscard]] virtual float GetStationaryY() const { return GetPositionY(); }
[[nodiscard]] virtual float GetStationaryZ() const { return GetPositionZ(); }
[[nodiscard]] virtual float GetStationaryO() const { return GetOrientation(); }
protected:
std::string m_name;
@@ -1078,9 +1078,9 @@ protected:
void SetLocationMapId(uint32 _mapId) { m_mapId = _mapId; }
void SetLocationInstanceId(uint32 _instanceId) { m_InstanceId = _instanceId; }
virtual bool IsNeverVisible() const { return !IsInWorld(); }
[[nodiscard]] virtual bool IsNeverVisible() const { return !IsInWorld(); }
virtual bool IsAlwaysVisibleFor(WorldObject const* /*seer*/) const { return false; }
virtual bool IsInvisibleDueToDespawn() const { return false; }
[[nodiscard]] virtual bool IsInvisibleDueToDespawn() const { return false; }
//difference from IsAlwaysVisibleFor: 1. after distance check; 2. use owner or charmer as seer
virtual bool IsAlwaysDetectableFor(WorldObject const* /*seer*/) const { return false; }
private:

View File

@@ -44,7 +44,7 @@ public:
void AddUpdateBlock(const ByteBuffer& block);
void AddUpdateBlock(const UpdateData& block);
bool BuildPacket(WorldPacket* packet);
bool HasData() const { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); }
[[nodiscard]] bool HasData() const { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); }
void Clear();
protected:

View File

@@ -34,7 +34,7 @@ public:
void SetBit(uint32 index) { _bits[index] = 1; }
void UnsetBit(uint32 index) { _bits[index] = 0; }
bool GetBit(uint32 index) const { return _bits[index] != 0; }
[[nodiscard]] bool GetBit(uint32 index) const { return _bits[index] != 0; }
void AppendToPacket(ByteBuffer* data)
{
@@ -49,8 +49,8 @@ public:
}
}
uint32 GetBlockCount() const { return _blockCount; }
uint32 GetCount() const { return _fieldCount; }
[[nodiscard]] uint32 GetBlockCount() const { return _blockCount; }
[[nodiscard]] uint32 GetCount() const { return _fieldCount; }
void SetCount(uint32 valuesCount)
{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -71,7 +71,7 @@ struct VehicleSeat
Passenger.Reset();
}
bool IsEmpty() const { return !Passenger.Guid; }
[[nodiscard]] bool IsEmpty() const { return !Passenger.Guid; }
VehicleSeatEntry const* SeatInfo;
PassengerInfo Passenger;

View File

@@ -55,7 +55,7 @@ struct GameEventData
std::string description;
uint8 announce; // if 0 dont announce, if 1 announce, if 2 take config value
bool isValid() const { return length > 0 || state > GAMEEVENT_NORMAL; }
[[nodiscard]] bool isValid() const { return length > 0 || state > GAMEEVENT_NORMAL; }
};
struct ModelEquip
@@ -90,10 +90,10 @@ public:
typedef std::set<uint16> ActiveEvents;
typedef std::vector<GameEventData> GameEventDataMap;
ActiveEvents const& GetActiveEventList() const { return m_ActiveEvents; }
GameEventDataMap const& GetEventMap() const { return mGameEvent; }
bool CheckOneGameEvent(uint16 entry) const;
uint32 NextCheck(uint16 entry) const;
[[nodiscard]] ActiveEvents const& GetActiveEventList() const { return m_ActiveEvents; }
[[nodiscard]] GameEventDataMap const& GetEventMap() const { return mGameEvent; }
[[nodiscard]] bool CheckOneGameEvent(uint16 entry) const;
[[nodiscard]] uint32 NextCheck(uint16 entry) const;
void LoadFromDB();
void LoadHolidayDates();
uint32 Update();

View File

@@ -368,7 +368,7 @@ struct ScriptInfo
} Movement;
};
std::string GetDebugInfo() const;
[[nodiscard]] std::string GetDebugInfo() const;
};
typedef std::multimap<uint32, ScriptInfo> ScriptMap;
@@ -443,7 +443,7 @@ struct BroadcastText
uint32 Unk2;
// uint32 VerifiedBuild;
std::string const& GetText(LocaleConstant locale = DEFAULT_LOCALE, uint8 gender = GENDER_MALE, bool forceGender = false) const
[[nodiscard]] std::string const& GetText(LocaleConstant locale = DEFAULT_LOCALE, uint8 gender = GENDER_MALE, bool forceGender = false) const
{
if (gender == GENDER_FEMALE && (forceGender || !FemaleText[DEFAULT_LOCALE].empty()))
{
@@ -717,11 +717,11 @@ public:
typedef std::map<uint32, uint32> CharacterConversionMap;
Player* GetPlayerByLowGUID(uint32 lowguid) const;
[[nodiscard]] Player* GetPlayerByLowGUID(uint32 lowguid) const;
GameObjectTemplate const* GetGameObjectTemplate(uint32 entry);
bool IsGameObjectStaticTransport(uint32 entry);
GameObjectTemplateContainer const* GetGameObjectTemplates() const { return &_gameObjectTemplateStore; }
[[nodiscard]] GameObjectTemplateContainer const* GetGameObjectTemplates() const { return &_gameObjectTemplateStore; }
int LoadReferenceVendor(int32 vendor, int32 item_id, std::set<uint32>* skip_vendors);
void LoadGameObjectTemplate();
@@ -729,7 +729,7 @@ public:
void AddGameobjectInfo(GameObjectTemplate* goinfo);
CreatureTemplate const* GetCreatureTemplate(uint32 entry);
CreatureTemplateContainer const* GetCreatureTemplates() const { return &_creatureTemplateStore; }
[[nodiscard]] CreatureTemplateContainer const* GetCreatureTemplates() const { return &_creatureTemplateStore; }
CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId);
CreatureModelInfo const* GetCreatureModelRandomGender(uint32* displayID);
static uint32 ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data = nullptr);
@@ -737,11 +737,11 @@ public:
EquipmentInfo const* GetEquipmentInfo(uint32 entry, int8& id);
CreatureAddon const* GetCreatureAddon(uint32 lowguid);
GameObjectAddon const* GetGameObjectAddon(uint32 lowguid);
GameObjectTemplateAddon const* GetGameObjectTemplateAddon(uint32 entry) const;
[[nodiscard]] GameObjectTemplateAddon const* GetGameObjectTemplateAddon(uint32 entry) const;
CreatureAddon const* GetCreatureTemplateAddon(uint32 entry);
ItemTemplate const* GetItemTemplate(uint32 entry);
ItemTemplateContainer const* GetItemTemplateStore() const { return &_itemTemplateStore; }
std::vector<ItemTemplate*> const* GetItemTemplateStoreFast() const { return &_itemTemplateStoreFast; }
[[nodiscard]] ItemTemplateContainer const* GetItemTemplateStore() const { return &_itemTemplateStore; }
[[nodiscard]] std::vector<ItemTemplate*> const* GetItemTemplateStoreFast() const { return &_itemTemplateStoreFast; }
ItemSetNameEntry const* GetItemSetNameEntry(uint32 itemId)
{
@@ -753,9 +753,9 @@ public:
InstanceTemplate const* GetInstanceTemplate(uint32 mapId);
PetLevelInfo const* GetPetLevelInfo(uint32 creature_id, uint8 level) const;
[[nodiscard]] PetLevelInfo const* GetPetLevelInfo(uint32 creature_id, uint8 level) const;
PlayerClassInfo const* GetPlayerClassInfo(uint32 class_) const
[[nodiscard]] PlayerClassInfo const* GetPlayerClassInfo(uint32 class_) const
{
if (class_ >= MAX_CLASSES)
return nullptr;
@@ -763,46 +763,46 @@ public:
}
void GetPlayerClassLevelInfo(uint32 class_, uint8 level, PlayerClassLevelInfo* info) const;
PlayerInfo const* GetPlayerInfo(uint32 race, uint32 class_) const;
[[nodiscard]] PlayerInfo const* GetPlayerInfo(uint32 race, uint32 class_) const;
void GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, PlayerLevelInfo* info) const;
uint64 GetPlayerGUIDByName(std::string const& name) const;
[[nodiscard]] uint64 GetPlayerGUIDByName(std::string const& name) const;
bool GetPlayerNameByGUID(uint64 guid, std::string& name) const;
TeamId GetPlayerTeamIdByGUID(uint64 guid) const;
uint32 GetPlayerAccountIdByGUID(uint64 guid) const;
uint32 GetPlayerAccountIdByPlayerName(std::string const& name) const;
[[nodiscard]] TeamId GetPlayerTeamIdByGUID(uint64 guid) const;
[[nodiscard]] uint32 GetPlayerAccountIdByGUID(uint64 guid) const;
[[nodiscard]] uint32 GetPlayerAccountIdByPlayerName(std::string const& name) const;
uint32 GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 teamId);
void GetTaxiPath(uint32 source, uint32 destination, uint32& path, uint32& cost);
uint32 GetTaxiMountDisplayId(uint32 id, TeamId teamId, bool allowed_alt_team = false);
GameObjectQuestItemList const* GetGameObjectQuestItemList(uint32 id) const
[[nodiscard]] GameObjectQuestItemList const* GetGameObjectQuestItemList(uint32 id) const
{
GameObjectQuestItemMap::const_iterator itr = _gameObjectQuestItemStore.find(id);
if (itr != _gameObjectQuestItemStore.end())
return &itr->second;
return nullptr;
}
GameObjectQuestItemMap const* GetGameObjectQuestItemMap() const { return &_gameObjectQuestItemStore; }
[[nodiscard]] GameObjectQuestItemMap const* GetGameObjectQuestItemMap() const { return &_gameObjectQuestItemStore; }
CreatureQuestItemList const* GetCreatureQuestItemList(uint32 id) const
[[nodiscard]] CreatureQuestItemList const* GetCreatureQuestItemList(uint32 id) const
{
CreatureQuestItemMap::const_iterator itr = _creatureQuestItemStore.find(id);
if (itr != _creatureQuestItemStore.end())
return &itr->second;
return nullptr;
}
CreatureQuestItemMap const* GetCreatureQuestItemMap() const { return &_creatureQuestItemStore; }
[[nodiscard]] CreatureQuestItemMap const* GetCreatureQuestItemMap() const { return &_creatureQuestItemStore; }
Quest const* GetQuestTemplate(uint32 quest_id) const
[[nodiscard]] Quest const* GetQuestTemplate(uint32 quest_id) const
{
return quest_id < _questTemplatesFast.size() ? _questTemplatesFast[quest_id] : nullptr;
}
QuestMap const& GetQuestTemplates() const { return _questTemplates; }
[[nodiscard]] QuestMap const& GetQuestTemplates() const { return _questTemplates; }
uint32 GetQuestForAreaTrigger(uint32 Trigger_ID) const
[[nodiscard]] uint32 GetQuestForAreaTrigger(uint32 Trigger_ID) const
{
QuestAreaTriggerContainer::const_iterator itr = _questAreaTriggerStore.find(Trigger_ID);
if (itr != _questAreaTriggerStore.end())
@@ -810,14 +810,14 @@ public:
return 0;
}
bool IsTavernAreaTrigger(uint32 Trigger_ID) const
[[nodiscard]] bool IsTavernAreaTrigger(uint32 Trigger_ID) const
{
return _tavernAreaTriggerStore.find(Trigger_ID) != _tavernAreaTriggerStore.end();
}
GossipText const* GetGossipText(uint32 Text_ID) const;
[[nodiscard]] GossipText const* GetGossipText(uint32 Text_ID) const;
AreaTrigger const* GetAreaTrigger(uint32 trigger) const
[[nodiscard]] AreaTrigger const* GetAreaTrigger(uint32 trigger) const
{
AreaTriggerContainer::const_iterator itr = _areaTriggerStore.find(trigger);
if (itr != _areaTriggerStore.end())
@@ -825,7 +825,7 @@ public:
return nullptr;
}
AreaTriggerTeleport const* GetAreaTriggerTeleport(uint32 trigger) const
[[nodiscard]] AreaTriggerTeleport const* GetAreaTriggerTeleport(uint32 trigger) const
{
AreaTriggerTeleportContainer::const_iterator itr = _areaTriggerTeleportStore.find(trigger);
if (itr != _areaTriggerTeleportStore.end())
@@ -833,7 +833,7 @@ public:
return nullptr;
}
AccessRequirement const* GetAccessRequirement(uint32 mapid, Difficulty difficulty) const
[[nodiscard]] AccessRequirement const* GetAccessRequirement(uint32 mapid, Difficulty difficulty) const
{
AccessRequirementContainer::const_iterator itr = _accessRequirementStore.find(MAKE_PAIR32(mapid, difficulty));
if (itr != _accessRequirementStore.end())
@@ -841,13 +841,13 @@ public:
return nullptr;
}
AreaTriggerTeleport const* GetGoBackTrigger(uint32 Map) const;
AreaTriggerTeleport const* GetMapEntranceTrigger(uint32 Map) const;
[[nodiscard]] AreaTriggerTeleport const* GetGoBackTrigger(uint32 Map) const;
[[nodiscard]] AreaTriggerTeleport const* GetMapEntranceTrigger(uint32 Map) const;
uint32 GetAreaTriggerScriptId(uint32 trigger_id);
SpellScriptsBounds GetSpellScriptsBounds(uint32 spell_id);
RepRewardRate const* GetRepRewardRate(uint32 factionId) const
[[nodiscard]] RepRewardRate const* GetRepRewardRate(uint32 factionId) const
{
RepRewardRateContainer::const_iterator itr = _repRewardRateStore.find(factionId);
if (itr != _repRewardRateStore.end())
@@ -856,7 +856,7 @@ public:
return nullptr;
}
ReputationOnKillEntry const* GetReputationOnKilEntry(uint32 id) const
[[nodiscard]] ReputationOnKillEntry const* GetReputationOnKilEntry(uint32 id) const
{
RepOnKillContainer::const_iterator itr = _repOnKillStore.find(id);
if (itr != _repOnKillStore.end())
@@ -866,7 +866,7 @@ public:
int32 GetBaseReputationOf(FactionEntry const* factionEntry, uint8 race, uint8 playerClass);
RepSpilloverTemplate const* GetRepSpilloverTemplate(uint32 factionId) const
[[nodiscard]] RepSpilloverTemplate const* GetRepSpilloverTemplate(uint32 factionId) const
{
RepSpilloverTemplateContainer::const_iterator itr = _repSpilloverTemplateStore.find(factionId);
if (itr != _repSpilloverTemplateStore.end())
@@ -875,7 +875,7 @@ public:
return nullptr;
}
PointOfInterest const* GetPointOfInterest(uint32 id) const
[[nodiscard]] PointOfInterest const* GetPointOfInterest(uint32 id) const
{
PointOfInterestContainer::const_iterator itr = _pointsOfInterestStore.find(id);
if (itr != _pointsOfInterestStore.end())
@@ -1045,9 +1045,9 @@ public:
std::string GeneratePetName(uint32 entry);
uint32 GetBaseXP(uint8 level);
uint32 GetXPForLevel(uint8 level) const;
[[nodiscard]] uint32 GetXPForLevel(uint8 level) const;
int32 GetFishingBaseSkillLevel(uint32 entry) const
[[nodiscard]] int32 GetFishingBaseSkillLevel(uint32 entry) const
{
FishingBaseSkillContainer::const_iterator itr = _fishingBaseForAreaStore.find(entry);
return itr != _fishingBaseForAreaStore.end() ? itr->second : 0;
@@ -1112,7 +1112,7 @@ public:
*
* @return null if group was not found, otherwise reference to the creature group data
*/
std::vector<TempSummonData> const* GetSummonGroup(uint32 summonerId, SummonerType summonerType, uint8 group) const
[[nodiscard]] std::vector<TempSummonData> const* GetSummonGroup(uint32 summonerId, SummonerType summonerType, uint8 group) const
{
TempSummonDataContainer::const_iterator itr = _tempSummonDataStore.find(TempSummonGroupKey(summonerId, summonerType, group));
if (itr != _tempSummonDataStore.end())
@@ -1121,14 +1121,14 @@ public:
return nullptr;
}
BroadcastText const* GetBroadcastText(uint32 id) const
[[nodiscard]] BroadcastText const* GetBroadcastText(uint32 id) const
{
BroadcastTextContainer::const_iterator itr = _broadcastTextStore.find(id);
if (itr != _broadcastTextStore.end())
return &itr->second;
return nullptr;
}
CreatureData const* GetCreatureData(uint32 guid) const
[[nodiscard]] CreatureData const* GetCreatureData(uint32 guid) const
{
CreatureDataContainer::const_iterator itr = _creatureDataStore.find(guid);
if (itr == _creatureDataStore.end()) return nullptr;
@@ -1136,80 +1136,80 @@ public:
}
CreatureData& NewOrExistCreatureData(uint32 guid) { return _creatureDataStore[guid]; }
void DeleteCreatureData(uint32 guid);
uint64 GetLinkedRespawnGuid(uint64 guid) const
[[nodiscard]] uint64 GetLinkedRespawnGuid(uint64 guid) const
{
LinkedRespawnContainer::const_iterator itr = _linkedRespawnStore.find(guid);
if (itr == _linkedRespawnStore.end()) return 0;
return itr->second;
}
GameObjectData const* GetGOData(uint32 guid) const
[[nodiscard]] GameObjectData const* GetGOData(uint32 guid) const
{
GameObjectDataContainer::const_iterator itr = _gameObjectDataStore.find(guid);
if (itr == _gameObjectDataStore.end()) return nullptr;
return &itr->second;
}
CreatureLocale const* GetCreatureLocale(uint32 entry) const
[[nodiscard]] CreatureLocale const* GetCreatureLocale(uint32 entry) const
{
CreatureLocaleContainer::const_iterator itr = _creatureLocaleStore.find(entry);
if (itr == _creatureLocaleStore.end()) return nullptr;
return &itr->second;
}
GameObjectLocale const* GetGameObjectLocale(uint32 entry) const
[[nodiscard]] GameObjectLocale const* GetGameObjectLocale(uint32 entry) const
{
GameObjectLocaleContainer::const_iterator itr = _gameObjectLocaleStore.find(entry);
if (itr == _gameObjectLocaleStore.end()) return nullptr;
return &itr->second;
}
ItemLocale const* GetItemLocale(uint32 entry) const
[[nodiscard]] ItemLocale const* GetItemLocale(uint32 entry) const
{
ItemLocaleContainer::const_iterator itr = _itemLocaleStore.find(entry);
if (itr == _itemLocaleStore.end()) return nullptr;
return &itr->second;
}
ItemSetNameLocale const* GetItemSetNameLocale(uint32 entry) const
[[nodiscard]] ItemSetNameLocale const* GetItemSetNameLocale(uint32 entry) const
{
ItemSetNameLocaleContainer::const_iterator itr = _itemSetNameLocaleStore.find(entry);
if (itr == _itemSetNameLocaleStore.end())return nullptr;
return &itr->second;
}
PageTextLocale const* GetPageTextLocale(uint32 entry) const
[[nodiscard]] PageTextLocale const* GetPageTextLocale(uint32 entry) const
{
PageTextLocaleContainer::const_iterator itr = _pageTextLocaleStore.find(entry);
if (itr == _pageTextLocaleStore.end()) return nullptr;
return &itr->second;
}
QuestLocale const* GetQuestLocale(uint32 entry) const
[[nodiscard]] QuestLocale const* GetQuestLocale(uint32 entry) const
{
QuestLocaleContainer::const_iterator itr = _questLocaleStore.find(entry);
if (itr == _questLocaleStore.end()) return nullptr;
return &itr->second;
}
GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const
[[nodiscard]] GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const
{
GossipMenuItemsLocaleContainer::const_iterator itr = _gossipMenuItemsLocaleStore.find(entry);
if (itr == _gossipMenuItemsLocaleStore.end()) return nullptr;
return &itr->second;
}
PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const
[[nodiscard]] PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const
{
PointOfInterestLocaleContainer::const_iterator itr = _pointOfInterestLocaleStore.find(poi_id);
if (itr == _pointOfInterestLocaleStore.end()) return nullptr;
return &itr->second;
}
QuestOfferRewardLocale const* GetQuestOfferRewardLocale(uint32 entry) const
[[nodiscard]] QuestOfferRewardLocale const* GetQuestOfferRewardLocale(uint32 entry) const
{
auto itr = _questOfferRewardLocaleStore.find(entry);
if (itr == _questOfferRewardLocaleStore.end()) return nullptr;
return &itr->second;
}
QuestRequestItemsLocale const* GetQuestRequestItemsLocale(uint32 entry) const
[[nodiscard]] QuestRequestItemsLocale const* GetQuestRequestItemsLocale(uint32 entry) const
{
auto itr = _questRequestItemsLocaleStore.find(entry);
if (itr == _questRequestItemsLocaleStore.end()) return nullptr;
return &itr->second;
}
NpcTextLocale const* GetNpcTextLocale(uint32 entry) const
[[nodiscard]] NpcTextLocale const* GetNpcTextLocale(uint32 entry) const
{
NpcTextLocaleContainer::const_iterator itr = _npcTextLocaleStore.find(entry);
if (itr == _npcTextLocaleStore.end()) return nullptr;
@@ -1218,7 +1218,7 @@ public:
GameObjectData& NewGOData(uint32 guid) { return _gameObjectDataStore[guid]; }
void DeleteGOData(uint32 guid);
AcoreString const* GetAcoreString(uint32 entry) const
[[nodiscard]] AcoreString const* GetAcoreString(uint32 entry) const
{
AcoreStringContainer::const_iterator itr = _acoreStringStore.find(entry);
if (itr == _acoreStringStore.end())
@@ -1226,9 +1226,9 @@ public:
return &itr->second;
}
char const* GetAcoreString(uint32 entry, LocaleConstant locale) const;
char const* GetAcoreStringForDBCLocale(uint32 entry) const { return GetAcoreString(entry, DBCLocaleIndex); }
LocaleConstant GetDBCLocaleIndex() const { return DBCLocaleIndex; }
[[nodiscard]] char const* GetAcoreString(uint32 entry, LocaleConstant locale) const;
[[nodiscard]] char const* GetAcoreStringForDBCLocale(uint32 entry) const { return GetAcoreString(entry, DBCLocaleIndex); }
[[nodiscard]] LocaleConstant GetDBCLocaleIndex() const { return DBCLocaleIndex; }
void SetDBCLocaleIndex(LocaleConstant locale) { DBCLocaleIndex = locale; }
void AddCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_guid, uint32 instance);
@@ -1245,7 +1245,7 @@ public:
// reserved names
void LoadReservedPlayersNames();
bool IsReservedName(std::string const& name) const;
[[nodiscard]] bool IsReservedName(std::string const& name) const;
// name with valid structure and symbols
static uint8 CheckPlayerName(std::string const& name, bool create = false);
@@ -1255,18 +1255,18 @@ public:
static bool CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names);
GameTele const* GetGameTele(uint32 id) const
[[nodiscard]] GameTele const* GetGameTele(uint32 id) const
{
GameTeleContainer::const_iterator itr = _gameTeleStore.find(id);
if (itr == _gameTeleStore.end()) return nullptr;
return &itr->second;
}
GameTele const* GetGameTele(std::string const& name) const;
GameTeleContainer const& GetGameTeleMap() const { return _gameTeleStore; }
[[nodiscard]] GameTele const* GetGameTele(std::string const& name) const;
[[nodiscard]] GameTeleContainer const& GetGameTeleMap() const { return _gameTeleStore; }
bool AddGameTele(GameTele& data);
bool DeleteGameTele(std::string const& name);
TrainerSpellData const* GetNpcTrainerSpells(uint32 entry) const
[[nodiscard]] TrainerSpellData const* GetNpcTrainerSpells(uint32 entry) const
{
CacheTrainerSpellContainer::const_iterator iter = _cacheTrainerSpellStore.find(entry);
if (iter == _cacheTrainerSpellStore.end())
@@ -1275,7 +1275,7 @@ public:
return &iter->second;
}
VendorItemData const* GetNpcVendorItemList(uint32 entry) const
[[nodiscard]] VendorItemData const* GetNpcVendorItemList(uint32 entry) const
{
CacheVendorItemContainer::const_iterator iter = _cacheVendorItemStore.find(entry);
if (iter == _cacheVendorItemStore.end())
@@ -1290,15 +1290,15 @@ public:
void LoadScriptNames();
ScriptNameContainer& GetScriptNames() { return _scriptNamesStore; }
const char* GetScriptName(uint32 id) const { return id < _scriptNamesStore.size() ? _scriptNamesStore[id].c_str() : ""; }
[[nodiscard]] const char* GetScriptName(uint32 id) const { return id < _scriptNamesStore.size() ? _scriptNamesStore[id].c_str() : ""; }
uint32 GetScriptId(const char* name);
SpellClickInfoMapBounds GetSpellClickInfoMapBounds(uint32 creature_id) const
[[nodiscard]] SpellClickInfoMapBounds GetSpellClickInfoMapBounds(uint32 creature_id) const
{
return _spellClickInfoStore.equal_range(creature_id);
}
GossipMenusMapBounds GetGossipMenusMapBounds(uint32 uiMenuId) const
[[nodiscard]] GossipMenusMapBounds GetGossipMenusMapBounds(uint32 uiMenuId) const
{
return _gossipMenusStore.equal_range(uiMenuId);
}
@@ -1308,7 +1308,7 @@ public:
return _gossipMenusStore.equal_range(uiMenuId);
}
GossipMenuItemsMapBounds GetGossipMenuItemsMapBounds(uint32 uiMenuId) const
[[nodiscard]] GossipMenuItemsMapBounds GetGossipMenuItemsMapBounds(uint32 uiMenuId) const
{
return _gossipMenuItemsStore.equal_range(uiMenuId);
}

View File

@@ -45,26 +45,26 @@ struct Cell
y = data.Part.grid_y * MAX_NUMBER_OF_CELLS + data.Part.cell_y;
}
bool DiffCell(const Cell& cell) const
[[nodiscard]] bool DiffCell(const Cell& cell) const
{
return(data.Part.cell_x != cell.data.Part.cell_x ||
data.Part.cell_y != cell.data.Part.cell_y);
}
bool DiffGrid(const Cell& cell) const
[[nodiscard]] bool DiffGrid(const Cell& cell) const
{
return(data.Part.grid_x != cell.data.Part.grid_x ||
data.Part.grid_y != cell.data.Part.grid_y);
}
uint32 CellX() const { return data.Part.cell_x; }
uint32 CellY() const { return data.Part.cell_y; }
uint32 GridX() const { return data.Part.grid_x; }
uint32 GridY() const { return data.Part.grid_y; }
bool NoCreate() const { return data.Part.nocreate; }
[[nodiscard]] uint32 CellX() const { return data.Part.cell_x; }
[[nodiscard]] uint32 CellY() const { return data.Part.cell_y; }
[[nodiscard]] uint32 GridX() const { return data.Part.grid_x; }
[[nodiscard]] uint32 GridY() const { return data.Part.grid_y; }
[[nodiscard]] bool NoCreate() const { return data.Part.nocreate; }
void SetNoCreate() { data.Part.nocreate = 1; }
CellCoord GetCellCoord() const
[[nodiscard]] CellCoord GetCellCoord() const
{
return CellCoord(
data.Part.grid_x * MAX_NUMBER_OF_CELLS + data.Part.cell_x,

View File

@@ -121,7 +121,7 @@ struct CoordPair
y_coord = LIMIT - 1;
}
bool IsCoordValid() const
[[nodiscard]] bool IsCoordValid() const
{
return x_coord < LIMIT && y_coord < LIMIT;
}
@@ -133,7 +133,7 @@ struct CoordPair
return *this;
}
uint32 GetId() const
[[nodiscard]] uint32 GetId() const
{
return y_coord * LIMIT + x_coord;
}

View File

@@ -37,21 +37,21 @@ public:
return i_cells[x][y];
}
GridType const& GetGridType(const uint32 x, const uint32 y) const
[[nodiscard]] GridType const& GetGridType(const uint32 x, const uint32 y) const
{
ASSERT(x < N && y < N);
return i_cells[x][y];
}
uint32 GetGridId(void) const { return i_gridId; }
int32 getX() const { return i_x; }
int32 getY() const { return i_y; }
[[nodiscard]] uint32 GetGridId(void) const { return i_gridId; }
[[nodiscard]] int32 getX() const { return i_x; }
[[nodiscard]] int32 getY() const { return i_y; }
void link(GridRefManager<NGrid<N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> >* pTo)
{
i_Reference.link(pTo, this);
}
bool isGridObjectDataLoaded() const { return i_GridObjectDataLoaded; }
[[nodiscard]] bool isGridObjectDataLoaded() const { return i_GridObjectDataLoaded; }
void setGridObjectDataLoaded(bool pLoaded) { i_GridObjectDataLoaded = pLoaded; }
/*

View File

@@ -23,8 +23,8 @@ public:
GroupReference() : Reference<Group, Player>(), iSubGroup(0) {}
~GroupReference() override { unlink(); }
GroupReference* next() { return (GroupReference*)Reference<Group, Player>::next(); }
GroupReference const* next() const { return (GroupReference const*)Reference<Group, Player>::next(); }
uint8 getSubGroup() const { return iSubGroup; }
[[nodiscard]] GroupReference const* next() const { return (GroupReference const*)Reference<Group, Player>::next(); }
[[nodiscard]] uint8 getSubGroup() const { return iSubGroup; }
void setSubGroup(uint8 pSubGroup) { iSubGroup = pSubGroup; }
};
#endif

View File

@@ -49,27 +49,27 @@ public:
InstanceSave(uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, time_t extendedResetTime);
~InstanceSave();
uint32 GetInstanceId() const { return m_instanceid; }
uint32 GetMapId() const { return m_mapid; }
Difficulty GetDifficulty() const { return m_difficulty; }
[[nodiscard]] uint32 GetInstanceId() const { return m_instanceid; }
[[nodiscard]] uint32 GetMapId() const { return m_mapid; }
[[nodiscard]] Difficulty GetDifficulty() const { return m_difficulty; }
/* Saved when the instance is generated for the first time */
void InsertToDB();
// pussywizard: deleting is done internally when there are no binds left
std::string GetInstanceData() const { return m_instanceData; }
[[nodiscard]] std::string GetInstanceData() const { return m_instanceData; }
void SetInstanceData(std::string str) { m_instanceData = str; }
uint32 GetCompletedEncounterMask() const { return m_completedEncounterMask; }
[[nodiscard]] uint32 GetCompletedEncounterMask() const { return m_completedEncounterMask; }
void SetCompletedEncounterMask(uint32 mask) { m_completedEncounterMask = mask; }
// pussywizard: for normal instances this corresponds to 0, for raid/heroic instances this caches the global reset time for the map
time_t GetResetTime() const { return m_resetTime; }
time_t GetExtendedResetTime() const { return m_extendedResetTime; }
[[nodiscard]] time_t GetResetTime() const { return m_resetTime; }
[[nodiscard]] time_t GetExtendedResetTime() const { return m_extendedResetTime; }
time_t GetResetTimeForDB();
void SetResetTime(time_t resetTime) { m_resetTime = resetTime; }
void SetExtendedResetTime(time_t extendedResetTime) { m_extendedResetTime = extendedResetTime; }
bool CanReset() const { return m_canReset; }
[[nodiscard]] bool CanReset() const { return m_canReset; }
void SetCanReset(bool canReset) { m_canReset = canReset; }
InstanceTemplate const* GetTemplate();
@@ -126,13 +126,13 @@ public:
void LoadInstanceSaves();
void LoadCharacterBinds();
time_t GetResetTimeFor(uint32 mapid, Difficulty d) const
[[nodiscard]] time_t GetResetTimeFor(uint32 mapid, Difficulty d) const
{
ResetTimeByMapDifficultyMap::const_iterator itr = m_resetTimeByMapDifficulty.find(MAKE_PAIR32(mapid, d));
return itr != m_resetTimeByMapDifficulty.end() ? itr->second : 0;
}
time_t GetExtendedResetTimeFor(uint32 mapid, Difficulty d) const
[[nodiscard]] time_t GetExtendedResetTimeFor(uint32 mapid, Difficulty d) const
{
ResetTimeByMapDifficultyMap::const_iterator itr = m_resetExtendedTimeByMapDifficulty.find(MAKE_PAIR32(mapid, d));
return itr != m_resetExtendedTimeByMapDifficulty.end() ? itr->second : 0;
@@ -148,7 +148,7 @@ public:
m_resetExtendedTimeByMapDifficulty[MAKE_PAIR32(mapid, d)] = t;
}
ResetTimeByMapDifficultyMap const& GetResetTimeMap() const
[[nodiscard]] ResetTimeByMapDifficultyMap const& GetResetTimeMap() const
{
return m_resetTimeByMapDifficulty;
}

View File

@@ -132,7 +132,7 @@ struct LootStoreItem
{}
bool Roll(bool rate, Player const* player, Loot& loot, LootStore const& store) const; // Checks if the entry takes it's chance (at loot generation)
bool IsValid(LootStore const& store, uint32 entry) const;
[[nodiscard]] bool IsValid(LootStore const& store, uint32 entry) const;
// Checks correctness of values
};
@@ -165,7 +165,7 @@ struct LootItem
bool AllowedForPlayer(Player const* player) const;
void AddAllowedLooter(Player const* player);
const AllowedLooterSet& GetAllowedLooters() const { return allowedGUIDs; }
[[nodiscard]] const AllowedLooterSet& GetAllowedLooters() const { return allowedGUIDs; }
};
struct QuestItem
@@ -207,16 +207,16 @@ public:
void ReportNonExistingId(uint32 lootId) const;
void ReportNonExistingId(uint32 lootId, const char* ownerType, uint32 ownerId) const;
bool HaveLootFor(uint32 loot_id) const { return m_LootTemplates.find(loot_id) != m_LootTemplates.end(); }
bool HaveQuestLootFor(uint32 loot_id) const;
[[nodiscard]] bool HaveLootFor(uint32 loot_id) const { return m_LootTemplates.find(loot_id) != m_LootTemplates.end(); }
[[nodiscard]] bool HaveQuestLootFor(uint32 loot_id) const;
bool HaveQuestLootForPlayer(uint32 loot_id, Player const* player) const;
LootTemplate const* GetLootFor(uint32 loot_id) const;
LootTemplate* GetLootForConditionFill(uint32 loot_id) const;
[[nodiscard]] LootTemplate const* GetLootFor(uint32 loot_id) const;
[[nodiscard]] LootTemplate* GetLootForConditionFill(uint32 loot_id) const;
char const* GetName() const { return m_name; }
char const* GetEntryName() const { return m_entryName; }
bool IsRatesAllowed() const { return m_ratesAllowed; }
[[nodiscard]] char const* GetName() const { return m_name; }
[[nodiscard]] char const* GetEntryName() const { return m_entryName; }
[[nodiscard]] bool IsRatesAllowed() const { return m_ratesAllowed; }
protected:
uint32 LoadLootTable();
void Clear();
@@ -244,7 +244,7 @@ public:
void CopyConditions(LootItem* li) const;
// True if template includes at least 1 quest drop entry
bool HasQuestDrop(LootTemplateMap const& store, uint8 groupId = 0) const;
[[nodiscard]] bool HasQuestDrop(LootTemplateMap const& store, uint8 groupId = 0) const;
// True if template includes at least 1 quest drop for an active quest of the player
bool HasQuestDropForPlayer(LootTemplateMap const& store, Player const* player, uint8 groupId = 0) const;
@@ -252,7 +252,7 @@ public:
void Verify(LootStore const& store, uint32 Id) const;
void CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_set) const;
bool addConditionItem(Condition* cond);
bool isReference(uint32 id) const;
[[nodiscard]] bool isReference(uint32 id) const;
private:
LootStoreItemList Entries; // not grouped only
@@ -299,9 +299,9 @@ struct Loot
{
friend ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv);
QuestItemMap const& GetPlayerQuestItems() const { return PlayerQuestItems; }
QuestItemMap const& GetPlayerFFAItems() const { return PlayerFFAItems; }
QuestItemMap const& GetPlayerNonQuestNonFFAConditionalItems() const { return PlayerNonQuestNonFFAConditionalItems; }
[[nodiscard]] QuestItemMap const& GetPlayerQuestItems() const { return PlayerQuestItems; }
[[nodiscard]] QuestItemMap const& GetPlayerFFAItems() const { return PlayerFFAItems; }
[[nodiscard]] QuestItemMap const& GetPlayerNonQuestNonFFAConditionalItems() const { return PlayerNonQuestNonFFAConditionalItems; }
std::vector<LootItem> items;
std::vector<LootItem> quest_items;
@@ -347,8 +347,8 @@ struct Loot
loot_type = LOOT_NONE;
}
bool empty() const { return items.empty() && gold == 0; }
bool isLooted() const { return gold == 0 && unlootedCount == 0; }
[[nodiscard]] bool empty() const { return items.empty() && gold == 0; }
[[nodiscard]] bool isLooted() const { return gold == 0 && unlootedCount == 0; }
void NotifyItemRemoved(uint8 lootIndex);
void NotifyQuestItemRemoved(uint8 questIndex);
@@ -365,7 +365,7 @@ struct Loot
LootItem* LootItemInSlot(uint32 lootslot, Player* player, QuestItem** qitem = NULL, QuestItem** ffaitem = NULL, QuestItem** conditem = nullptr);
uint32 GetMaxSlotInLootFor(Player* player) const;
bool hasItemFor(Player* player) const;
bool hasOverThresholdItem() const;
[[nodiscard]] bool hasOverThresholdItem() const;
private:
void FillNotNormalLootFor(Player* player, bool presentAtLooting);

View File

@@ -79,9 +79,9 @@ public: // Constructors
MailSender(Player* sender);
MailSender(uint32 senderEntry);
public: // Accessors
MailMessageType GetMailMessageType() const { return m_messageType; }
uint32 GetSenderId() const { return m_senderId; }
MailStationery GetStationery() const { return m_stationery; }
[[nodiscard]] MailMessageType GetMailMessageType() const { return m_messageType; }
[[nodiscard]] uint32 GetSenderId() const { return m_senderId; }
[[nodiscard]] MailStationery GetStationery() const { return m_stationery; }
private:
MailMessageType m_messageType;
uint32 m_senderId; // player low guid or other object entry
@@ -95,8 +95,8 @@ public: // Constructors
MailReceiver(Player* receiver);
MailReceiver(Player* receiver, uint32 receiver_lowguid);
public: // Accessors
Player* GetPlayer() const { return m_receiver; }
uint32 GetPlayerGUIDLow() const { return m_receiver_lowguid; }
[[nodiscard]] Player* GetPlayer() const { return m_receiver; }
[[nodiscard]] uint32 GetPlayerGUIDLow() const { return m_receiver_lowguid; }
private:
Player* m_receiver;
uint32 m_receiver_lowguid;
@@ -113,11 +113,11 @@ public: // Constructors
MailDraft(std::string const& subject, std::string const& body)
: m_mailTemplateId(0), m_mailTemplateItemsNeed(false), m_subject(subject), m_body(body), m_money(0), m_COD(0) {}
public: // Accessors
uint16 GetMailTemplateId() const { return m_mailTemplateId; }
std::string const& GetSubject() const { return m_subject; }
uint32 GetMoney() const { return m_money; }
uint32 GetCOD() const { return m_COD; }
std::string const& GetBody() const { return m_body; }
[[nodiscard]] uint16 GetMailTemplateId() const { return m_mailTemplateId; }
[[nodiscard]] std::string const& GetSubject() const { return m_subject; }
[[nodiscard]] uint32 GetMoney() const { return m_money; }
[[nodiscard]] uint32 GetCOD() const { return m_COD; }
[[nodiscard]] std::string const& GetBody() const { return m_body; }
public: // modifiers
MailDraft& AddItem(Item* item);
@@ -190,7 +190,7 @@ struct Mail
return false;
}
bool HasItems() const { return !items.empty(); }
[[nodiscard]] bool HasItems() const { return !items.empty(); }
};
#endif

View File

@@ -197,10 +197,10 @@ class GridMap
// Get height functions and pointers
typedef float (GridMap::*GetHeightPtr) (float x, float y) const;
GetHeightPtr _gridGetHeight;
float getHeightFromFloat(float x, float y) const;
float getHeightFromUint16(float x, float y) const;
float getHeightFromUint8(float x, float y) const;
float getHeightFromFlat(float x, float y) const;
[[nodiscard]] float getHeightFromFloat(float x, float y) const;
[[nodiscard]] float getHeightFromUint16(float x, float y) const;
[[nodiscard]] float getHeightFromUint8(float x, float y) const;
[[nodiscard]] float getHeightFromFlat(float x, float y) const;
public:
GridMap();
@@ -208,11 +208,11 @@ public:
bool loadData(char* filaname);
void unloadData();
uint16 getArea(float x, float y) const;
inline float getHeight(float x, float y) const {return (this->*_gridGetHeight)(x, y);}
float getMinHeight(float x, float y) const;
float getLiquidLevel(float x, float y) const;
uint8 getTerrainType(float x, float y) const;
[[nodiscard]] uint16 getArea(float x, float y) const;
[[nodiscard]] inline float getHeight(float x, float y) const {return (this->*_gridGetHeight)(x, y);}
[[nodiscard]] float getMinHeight(float x, float y) const;
[[nodiscard]] float getLiquidLevel(float x, float y) const;
[[nodiscard]] uint8 getTerrainType(float x, float y) const;
ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0);
};
@@ -276,7 +276,7 @@ public:
Map(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _parent = nullptr);
~Map() override;
MapEntry const* GetEntry() const { return i_mapEntry; }
[[nodiscard]] MapEntry const* GetEntry() const { return i_mapEntry; }
// currently unused for normal maps
bool CanUnload(uint32 diff)
@@ -308,7 +308,7 @@ public:
virtual void Update(const uint32, const uint32, bool thread = true);
float GetVisibilityRange() const { return m_VisibleDistance; }
[[nodiscard]] float GetVisibilityRange() const { return m_VisibleDistance; }
void SetVisibilityRange(float range) { m_VisibleDistance = range; }
//function for setting up visibility distance for maps on per-type/per-Id basis
virtual void InitVisibilityDistance();
@@ -320,13 +320,13 @@ public:
template<class T, class CONTAINER> void Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER>& visitor);
bool IsRemovalGrid(float x, float y) const
[[nodiscard]] bool IsRemovalGrid(float x, float y) const
{
GridCoord p = acore::ComputeGridCoord(x, y);
return !getNGrid(p.x_coord, p.y_coord);
}
bool IsGridLoaded(float x, float y) const
[[nodiscard]] bool IsGridLoaded(float x, float y) const
{
return IsGridLoaded(acore::ComputeGridCoord(x, y));
}
@@ -336,15 +336,15 @@ public:
bool UnloadGrid(NGridType& ngrid);
virtual void UnloadAll();
uint32 GetId(void) const { return i_mapEntry->MapID; }
[[nodiscard]] uint32 GetId(void) const { return i_mapEntry->MapID; }
static bool ExistMap(uint32 mapid, int gx, int gy);
static bool ExistVMap(uint32 mapid, int gx, int gy);
Map const* GetParent() const { return m_parentMap; }
[[nodiscard]] Map const* GetParent() const { return m_parentMap; }
// pussywizard: movemaps, mmaps
ACE_RW_Thread_Mutex& GetMMapLock() const { return *(const_cast<ACE_RW_Thread_Mutex*>(&MMapLock)); }
[[nodiscard]] ACE_RW_Thread_Mutex& GetMMapLock() const { return *(const_cast<ACE_RW_Thread_Mutex*>(&MMapLock)); }
// pussywizard:
std::unordered_set<Object*> i_objectsToUpdate;
void BuildAndSendUpdateForObjects(); // definition in ObjectAccessor.cpp, below ObjectAccessor::Update, because it does the same for a map
@@ -353,24 +353,24 @@ public:
// some calls like isInWater should not use vmaps due to processor power
// can return INVALID_HEIGHT if under z+2 z coord not found height
float GetHeight(float x, float y, float z, bool checkVMap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const;
float GetMinHeight(float x, float y) const;
[[nodiscard]] float GetHeight(float x, float y, float z, bool checkVMap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const;
[[nodiscard]] float GetMinHeight(float x, float y) const;
Transport* GetTransportForPos(uint32 phase, float x, float y, float z, WorldObject* worldobject = nullptr);
ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0) const;
uint32 GetAreaId(float x, float y, float z, bool* isOutdoors) const;
bool GetAreaInfo(float x, float y, float z, uint32& mogpflags, int32& adtId, int32& rootId, int32& groupId) const;
uint32 GetAreaId(float x, float y, float z) const;
uint32 GetZoneId(float x, float y, float z) const;
[[nodiscard]] uint32 GetAreaId(float x, float y, float z) const;
[[nodiscard]] uint32 GetZoneId(float x, float y, float z) const;
void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, float x, float y, float z) const;
bool IsOutdoors(float x, float y, float z) const;
[[nodiscard]] bool IsOutdoors(float x, float y, float z) const;
uint8 GetTerrainType(float x, float y) const;
float GetWaterLevel(float x, float y) const;
[[nodiscard]] uint8 GetTerrainType(float x, float y) const;
[[nodiscard]] float GetWaterLevel(float x, float y) const;
bool IsInWater(float x, float y, float z, LiquidData* data = 0) const;
bool IsUnderWater(float x, float y, float z) const;
[[nodiscard]] bool IsUnderWater(float x, float y, float z) const;
void MoveAllCreaturesInMoveList();
void MoveAllGameObjectsInMoveList();
@@ -378,26 +378,26 @@ public:
void RemoveAllObjectsInRemoveList();
virtual void RemoveAllPlayers();
uint32 GetInstanceId() const { return i_InstanceId; }
uint8 GetSpawnMode() const { return (i_spawnMode); }
[[nodiscard]] uint32 GetInstanceId() const { return i_InstanceId; }
[[nodiscard]] uint8 GetSpawnMode() const { return (i_spawnMode); }
virtual bool CanEnter(Player* /*player*/, bool /*loginCheck = false*/) { return true; }
const char* GetMapName() const;
[[nodiscard]] const char* GetMapName() const;
// have meaning only for instanced map (that have set real difficulty)
Difficulty GetDifficulty() const { return Difficulty(GetSpawnMode()); }
bool IsRegularDifficulty() const { return GetDifficulty() == REGULAR_DIFFICULTY; }
MapDifficulty const* GetMapDifficulty() const;
[[nodiscard]] Difficulty GetDifficulty() const { return Difficulty(GetSpawnMode()); }
[[nodiscard]] bool IsRegularDifficulty() const { return GetDifficulty() == REGULAR_DIFFICULTY; }
[[nodiscard]] MapDifficulty const* GetMapDifficulty() const;
bool Instanceable() const { return i_mapEntry && i_mapEntry->Instanceable(); }
bool IsDungeon() const { return i_mapEntry && i_mapEntry->IsDungeon(); }
bool IsNonRaidDungeon() const { return i_mapEntry && i_mapEntry->IsNonRaidDungeon(); }
bool IsRaid() const { return i_mapEntry && i_mapEntry->IsRaid(); }
bool IsRaidOrHeroicDungeon() const { return IsRaid() || i_spawnMode > DUNGEON_DIFFICULTY_NORMAL; }
bool IsHeroic() const { return IsRaid() ? i_spawnMode >= RAID_DIFFICULTY_10MAN_HEROIC : i_spawnMode >= DUNGEON_DIFFICULTY_HEROIC; }
bool Is25ManRaid() const { return IsRaid() && i_spawnMode & RAID_DIFFICULTY_MASK_25MAN; } // since 25man difficulties are 1 and 3, we can check them like that
bool IsBattleground() const { return i_mapEntry && i_mapEntry->IsBattleground(); }
bool IsBattleArena() const { return i_mapEntry && i_mapEntry->IsBattleArena(); }
bool IsBattlegroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattlegroundOrArena(); }
[[nodiscard]] bool Instanceable() const { return i_mapEntry && i_mapEntry->Instanceable(); }
[[nodiscard]] bool IsDungeon() const { return i_mapEntry && i_mapEntry->IsDungeon(); }
[[nodiscard]] bool IsNonRaidDungeon() const { return i_mapEntry && i_mapEntry->IsNonRaidDungeon(); }
[[nodiscard]] bool IsRaid() const { return i_mapEntry && i_mapEntry->IsRaid(); }
[[nodiscard]] bool IsRaidOrHeroicDungeon() const { return IsRaid() || i_spawnMode > DUNGEON_DIFFICULTY_NORMAL; }
[[nodiscard]] bool IsHeroic() const { return IsRaid() ? i_spawnMode >= RAID_DIFFICULTY_10MAN_HEROIC : i_spawnMode >= DUNGEON_DIFFICULTY_HEROIC; }
[[nodiscard]] bool Is25ManRaid() const { return IsRaid() && i_spawnMode & RAID_DIFFICULTY_MASK_25MAN; } // since 25man difficulties are 1 and 3, we can check them like that
[[nodiscard]] bool IsBattleground() const { return i_mapEntry && i_mapEntry->IsBattleground(); }
[[nodiscard]] bool IsBattleArena() const { return i_mapEntry && i_mapEntry->IsBattleArena(); }
[[nodiscard]] bool IsBattlegroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattlegroundOrArena(); }
bool GetEntrancePos(int32& mapid, float& x, float& y)
{
if (!i_mapEntry)
@@ -419,8 +419,8 @@ public:
bool isCellMarkedLarge(uint32 pCellId) { return marked_cells_large.test(pCellId); }
void markCellLarge(uint32 pCellId) { marked_cells_large.set(pCellId); }
bool HavePlayers() const { return !m_mapRefManager.isEmpty(); }
uint32 GetPlayersCountExceptGMs() const;
[[nodiscard]] bool HavePlayers() const { return !m_mapRefManager.isEmpty(); }
[[nodiscard]] uint32 GetPlayersCountExceptGMs() const;
void AddWorldObject(WorldObject* obj) { i_worldObjects.insert(obj); }
void RemoveWorldObject(WorldObject* obj) { i_worldObjects.erase(obj); }
@@ -428,7 +428,7 @@ public:
void SendToPlayers(WorldPacket const* data) const;
typedef MapRefManager PlayerList;
PlayerList const& GetPlayers() const { return m_mapRefManager; }
[[nodiscard]] PlayerList const& GetPlayers() const { return m_mapRefManager; }
//per-map script storage
void ScriptsStart(std::map<uint32, std::multimap<uint32, ScriptInfo> > const& scripts, uint32 id, Object* source, Object* target);
@@ -463,29 +463,29 @@ public:
Corpse* GetCorpse(uint64 guid);
MapInstanced* ToMapInstanced() { if (Instanceable()) return reinterpret_cast<MapInstanced*>(this); else return nullptr; }
const MapInstanced* ToMapInstanced() const { if (Instanceable()) return (const MapInstanced*)((MapInstanced*)this); else return nullptr; }
[[nodiscard]] const MapInstanced* ToMapInstanced() const { if (Instanceable()) return (const MapInstanced*)((MapInstanced*)this); else return nullptr; }
InstanceMap* ToInstanceMap() { if (IsDungeon()) return reinterpret_cast<InstanceMap*>(this); else return nullptr; }
const InstanceMap* ToInstanceMap() const { if (IsDungeon()) return (const InstanceMap*)((InstanceMap*)this); else return nullptr; }
[[nodiscard]] const InstanceMap* ToInstanceMap() const { if (IsDungeon()) return (const InstanceMap*)((InstanceMap*)this); else return nullptr; }
BattlegroundMap* ToBattlegroundMap() { if (IsBattlegroundOrArena()) return reinterpret_cast<BattlegroundMap*>(this); else return nullptr; }
const BattlegroundMap* ToBattlegroundMap() const { if (IsBattlegroundOrArena()) return reinterpret_cast<BattlegroundMap const*>(this); return nullptr; }
[[nodiscard]] const BattlegroundMap* ToBattlegroundMap() const { if (IsBattlegroundOrArena()) return reinterpret_cast<BattlegroundMap const*>(this); return nullptr; }
float GetWaterOrGroundLevel(uint32 phasemask, float x, float y, float z, float* ground = NULL, bool swim = false, float maxSearchDist = 50.0f) const;
float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const;
bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask, LineOfSightChecks checks) const;
[[nodiscard]] float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const;
[[nodiscard]] bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask, LineOfSightChecks checks) const;
void Balance() { _dynamicTree.balance(); }
void RemoveGameObjectModel(const GameObjectModel& model) { _dynamicTree.remove(model); }
void InsertGameObjectModel(const GameObjectModel& model) { _dynamicTree.insert(model); }
bool ContainsGameObjectModel(const GameObjectModel& model) const { return _dynamicTree.contains(model);}
DynamicMapTree const& GetDynamicMapTree() const { return _dynamicTree; }
[[nodiscard]] bool ContainsGameObjectModel(const GameObjectModel& model) const { return _dynamicTree.contains(model);}
[[nodiscard]] DynamicMapTree const& GetDynamicMapTree() const { return _dynamicTree; }
bool getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist);
/*
RESPAWN TIMES
*/
time_t GetLinkedRespawnTime(uint64 guid) const;
time_t GetCreatureRespawnTime(uint32 dbGuid) const
[[nodiscard]] time_t GetLinkedRespawnTime(uint64 guid) const;
[[nodiscard]] time_t GetCreatureRespawnTime(uint32 dbGuid) const
{
std::unordered_map<uint32 /*dbGUID*/, time_t>::const_iterator itr = _creatureRespawnTimes.find(dbGuid);
if (itr != _creatureRespawnTimes.end())
@@ -494,7 +494,7 @@ public:
return time_t(0);
}
time_t GetGORespawnTime(uint32 dbGuid) const
[[nodiscard]] time_t GetGORespawnTime(uint32 dbGuid) const
{
std::unordered_map<uint32 /*dbGUID*/, time_t>::const_iterator itr = _goRespawnTimes.find(dbGuid);
if (itr != _goRespawnTimes.end())
@@ -509,7 +509,7 @@ public:
void RemoveGORespawnTime(uint32 dbGuid);
void LoadRespawnTimes();
void DeleteRespawnTimes();
time_t GetInstanceResetPeriod() const { return _instanceResetPeriod; }
[[nodiscard]] time_t GetInstanceResetPeriod() const { return _instanceResetPeriod; }
static void DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId);
@@ -529,9 +529,9 @@ public:
GridMap* GetGrid(float x, float y);
void EnsureGridCreated(const GridCoord&);
bool AllTransportsEmpty() const; // pussywizard
[[nodiscard]] bool AllTransportsEmpty() const; // pussywizard
void AllTransportsRemovePassengers(); // pussywizard
TransportsContainer const& GetAllTransports() const { return _transports; }
[[nodiscard]] TransportsContainer const& GetAllTransports() const { return _transports; }
DataMap CustomData;
@@ -555,19 +555,19 @@ private:
std::vector<GameObject*> _gameObjectsToMove;
std::vector<DynamicObject*> _dynamicObjectsToMove;
bool IsGridLoaded(const GridCoord&) const;
[[nodiscard]] bool IsGridLoaded(const GridCoord&) const;
void EnsureGridCreated_i(const GridCoord&);
void buildNGridLinkage(NGridType* pNGridType) { pNGridType->link(this); }
NGridType* getNGrid(uint32 x, uint32 y) const
[[nodiscard]] NGridType* getNGrid(uint32 x, uint32 y) const
{
ASSERT(x < MAX_NUMBER_OF_GRIDS && y < MAX_NUMBER_OF_GRIDS);
return i_grids[x][y];
}
bool EnsureGridLoaded(Cell const&);
bool isGridObjectDataLoaded(uint32 x, uint32 y) const { return getNGrid(x, y)->isGridObjectDataLoaded(); }
[[nodiscard]] bool isGridObjectDataLoaded(uint32 x, uint32 y) const { return getNGrid(x, y)->isGridObjectDataLoaded(); }
void setGridObjectDataLoaded(bool pLoaded, uint32 x, uint32 y) { getNGrid(x, y)->setGridObjectDataLoaded(pLoaded); }
void setNGrid(NGridType* grid, uint32 x, uint32 y);
@@ -690,8 +690,8 @@ public:
bool CanEnter(Player* player, bool loginCheck = false) override;
void SendResetWarnings(uint32 timeLeft) const;
uint32 GetMaxPlayers() const;
uint32 GetMaxResetDelay() const;
[[nodiscard]] uint32 GetMaxPlayers() const;
[[nodiscard]] uint32 GetMaxResetDelay() const;
void InitVisibilityDistance() override;
private:

View File

@@ -18,16 +18,16 @@ public:
typedef LinkedListHead::Iterator< MapReference const > const_iterator;
MapReference* getFirst() { return (MapReference*)RefManager<Map, Player>::getFirst(); }
MapReference const* getFirst() const { return (MapReference const*)RefManager<Map, Player>::getFirst(); }
[[nodiscard]] MapReference const* getFirst() const { return (MapReference const*)RefManager<Map, Player>::getFirst(); }
MapReference* getLast() { return (MapReference*)RefManager<Map, Player>::getLast(); }
MapReference const* getLast() const { return (MapReference const*)RefManager<Map, Player>::getLast(); }
[[nodiscard]] MapReference const* getLast() const { return (MapReference const*)RefManager<Map, Player>::getLast(); }
iterator begin() { return iterator(getFirst()); }
iterator end() { return iterator(nullptr); }
iterator rbegin() { return iterator(getLast()); }
iterator rend() { return iterator(nullptr); }
const_iterator begin() const { return const_iterator(getFirst()); }
const_iterator end() const { return const_iterator(nullptr); }
[[nodiscard]] const_iterator begin() const { return const_iterator(getFirst()); }
[[nodiscard]] const_iterator end() const { return const_iterator(nullptr); }
};
#endif

View File

@@ -33,9 +33,9 @@ public:
MapReference() : Reference<Map, Player>() {}
~MapReference() override { unlink(); }
MapReference* next() { return (MapReference*)Reference<Map, Player>::next(); }
MapReference const* next() const { return (MapReference const*)Reference<Map, Player>::next(); }
[[nodiscard]] MapReference const* next() const { return (MapReference const*)Reference<Map, Player>::next(); }
MapReference* nockeck_prev() { return (MapReference*)Reference<Map, Player>::nocheck_prev(); }
MapReference const* nocheck_prev() const { return (MapReference const*)Reference<Map, Player>::nocheck_prev(); }
[[nodiscard]] MapReference const* nocheck_prev() const { return (MapReference const*)Reference<Map, Player>::nocheck_prev(); }
};
#endif

View File

@@ -85,7 +85,7 @@ private:
--_top;
}
bool needInitTop() const
[[nodiscard]] bool needInitTop() const
{
if (empty())
return false;
@@ -107,20 +107,20 @@ public:
void Initialize();
void InitDefault();
bool empty() const { return (_top < 0); }
int size() const { return _top + 1; }
_Ty top() const
[[nodiscard]] bool empty() const { return (_top < 0); }
[[nodiscard]] int size() const { return _top + 1; }
[[nodiscard]] _Ty top() const
{
ASSERT(!empty());
return Impl[_top];
}
_Ty GetMotionSlot(int slot) const
[[nodiscard]] _Ty GetMotionSlot(int slot) const
{
ASSERT(slot >= 0);
return Impl[slot];
}
uint8 GetCleanFlags() const { return _cleanFlag; }
[[nodiscard]] uint8 GetCleanFlags() const { return _cleanFlag; }
void DirectDelete(_Ty curr);
void DelayedDelete(_Ty curr);
@@ -193,9 +193,9 @@ public:
void MovePath(uint32 path_id, bool repeatable);
void MoveRotate(uint32 time, RotateDirection direction);
MovementGeneratorType GetCurrentMovementGeneratorType() const;
MovementGeneratorType GetMotionSlotType(int slot) const;
uint32 GetCurrentSplineId() const; // Xinef: Escort system
[[nodiscard]] MovementGeneratorType GetCurrentMovementGeneratorType() const;
[[nodiscard]] MovementGeneratorType GetMotionSlotType(int slot) const;
[[nodiscard]] uint32 GetCurrentSplineId() const; // Xinef: Escort system
void propagateSpeedChange();
void ReinitializeMovement();

View File

@@ -60,26 +60,26 @@ namespace Movement
void init_spline(const MoveSplineInitArgs& args);
protected:
const MySpline::ControlArray& getPath(bool visual) const { return spline.getPoints(visual); }
[[nodiscard]] const MySpline::ControlArray& getPath(bool visual) const { return spline.getPoints(visual); }
void computeParabolicElevation(float& el) const;
void computeFallElevation(float& el) const;
UpdateResult _updateState(int32& ms_time_diff);
int32 next_timestamp() const { return spline.length(point_Idx + 1); }
int32 segment_time_elapsed() const { return next_timestamp() - time_passed; }
[[nodiscard]] int32 next_timestamp() const { return spline.length(point_Idx + 1); }
[[nodiscard]] int32 segment_time_elapsed() const { return next_timestamp() - time_passed; }
public:
int32 timeElapsed() const { return Duration() - time_passed; } // xinef: moved to public for waypoint movegen
int32 timePassed() const { return time_passed; } // xinef: moved to public for waypoint movegen
int32 Duration() const { return spline.length(); }
MySpline const& _Spline() const { return spline; }
int32 _currentSplineIdx() const { return point_Idx; }
[[nodiscard]] int32 timeElapsed() const { return Duration() - time_passed; } // xinef: moved to public for waypoint movegen
[[nodiscard]] int32 timePassed() const { return time_passed; } // xinef: moved to public for waypoint movegen
[[nodiscard]] int32 Duration() const { return spline.length(); }
[[nodiscard]] MySpline const& _Spline() const { return spline; }
[[nodiscard]] int32 _currentSplineIdx() const { return point_Idx; }
void _Finalize();
void _Interrupt() { splineflags.done = true; }
public:
void Initialize(const MoveSplineInitArgs&);
bool Initialized() const { return !spline.empty(); }
[[nodiscard]] bool Initialized() const { return !spline.empty(); }
MoveSpline();
@@ -99,19 +99,19 @@ namespace Movement
while (difftime > 0);
}
Location ComputePosition() const;
[[nodiscard]] Location ComputePosition() const;
uint32 GetId() const { return m_Id; }
bool Finalized() const { return splineflags.done; }
bool isCyclic() const { return splineflags.cyclic; }
bool isFalling() const { return splineflags.falling; }
bool isWalking() const { return splineflags.walkmode; }
Vector3 FinalDestination() const { return Initialized() ? spline.getPoint(spline.last(), false) : Vector3(); }
Vector3 CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx + 1, false) : Vector3(); }
int32 currentPathIdx() const;
[[nodiscard]] uint32 GetId() const { return m_Id; }
[[nodiscard]] bool Finalized() const { return splineflags.done; }
[[nodiscard]] bool isCyclic() const { return splineflags.cyclic; }
[[nodiscard]] bool isFalling() const { return splineflags.falling; }
[[nodiscard]] bool isWalking() const { return splineflags.walkmode; }
[[nodiscard]] Vector3 FinalDestination() const { return Initialized() ? spline.getPoint(spline.last(), false) : Vector3(); }
[[nodiscard]] Vector3 CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx + 1, false) : Vector3(); }
[[nodiscard]] int32 currentPathIdx() const;
bool onTransport;
std::string ToString() const;
[[nodiscard]] std::string ToString() const;
};
}
#endif // TRINITYSERVER_MOVEPLINE_H

View File

@@ -63,7 +63,7 @@ namespace Movement
};
inline uint32& raw() { return (uint32&) * this; }
inline const uint32& raw() const { return (const uint32&) * this; }
[[nodiscard]] inline const uint32& raw() const { return (const uint32&) * this; }
MoveSplineFlag() { raw() = 0; }
MoveSplineFlag(uint32 f) { raw() = f; }
@@ -77,16 +77,16 @@ namespace Movement
// Constant interface
bool isSmooth() const { return raw() & Mask_CatmullRom; }
bool isLinear() const { return !isSmooth(); }
bool isFacing() const { return raw() & Mask_Final_Facing; }
[[nodiscard]] bool isSmooth() const { return raw() & Mask_CatmullRom; }
[[nodiscard]] bool isLinear() const { return !isSmooth(); }
[[nodiscard]] bool isFacing() const { return raw() & Mask_Final_Facing; }
uint8 getAnimationId() const { return animId; }
bool hasAllFlags(uint32 f) const { return (raw() & f) == f; }
bool hasFlag(uint32 f) const { return (raw() & f) != 0; }
[[nodiscard]] uint8 getAnimationId() const { return animId; }
[[nodiscard]] bool hasAllFlags(uint32 f) const { return (raw() & f) == f; }
[[nodiscard]] bool hasFlag(uint32 f) const { return (raw() & f) != 0; }
uint32 operator & (uint32 f) const { return (raw() & f); }
uint32 operator | (uint32 f) const { return (raw() | f); }
std::string ToString() const;
[[nodiscard]] std::string ToString() const;
// Not constant interface

View File

@@ -55,7 +55,7 @@ namespace Movement
bool Validate(Unit* unit) const;
private:
bool _checkPathBounds() const;
[[nodiscard]] bool _checkPathBounds() const;
};
}

View File

@@ -61,9 +61,9 @@ namespace Movement
void EvaluateDerivativeBezier3(index_type, float, Vector3&) const;
static EvaluationMethtod derivative_evaluators[ModesEnd];
float SegLengthLinear(index_type) const;
float SegLengthCatmullRom(index_type) const;
float SegLengthBezier3(index_type) const;
[[nodiscard]] float SegLengthLinear(index_type) const;
[[nodiscard]] float SegLengthCatmullRom(index_type) const;
[[nodiscard]] float SegLengthBezier3(index_type) const;
typedef float (SplineBase::*SegLenghtMethtod)(index_type) const;
static SegLenghtMethtod seglengths[ModesEnd];
@@ -74,7 +74,7 @@ namespace Movement
static InitMethtod initializers[ModesEnd];
void UninitializedSplineEvaluationMethod(index_type, float, Vector3&) const { ABORT(); }
float UninitializedSplineSegLenghtMethod(index_type) const { ABORT(); }
[[nodiscard]] float UninitializedSplineSegLenghtMethod(index_type) const { ABORT(); }
void UninitializedSplineInitMethod(Vector3 const*, index_type, bool, index_type) { ABORT(); }
public:
@@ -94,18 +94,18 @@ namespace Movement
void evaluate_derivative(index_type Idx, float u, Vector3& hermite) const {(this->*derivative_evaluators[m_mode])(Idx, u, hermite);}
/** Bounds for spline indexes. All indexes should be in range [first, last). */
index_type first() const { return index_lo;}
index_type last() const { return index_hi;}
[[nodiscard]] index_type first() const { return index_lo;}
[[nodiscard]] index_type last() const { return index_hi;}
bool empty() const { return index_lo == index_hi;}
EvaluationMode mode() const { return (EvaluationMode)m_mode;}
bool isCyclic() const { return cyclic;}
[[nodiscard]] bool empty() const { return index_lo == index_hi;}
[[nodiscard]] EvaluationMode mode() const { return (EvaluationMode)m_mode;}
[[nodiscard]] bool isCyclic() const { return cyclic;}
// Xinef: DO NOT USE EXCEPT FOR SPLINE INITIALIZATION!!!!!!
const ControlArray* allocateVisualPoints() const { return &pointsVisual; }
const ControlArray& getPoints(bool visual) const { return visual ? pointsVisual : points;}
index_type getPointCount() const { return points.size();}
const Vector3& getPoint(index_type i, bool visual) const { return visual ? pointsVisual[i] : points[i];}
[[nodiscard]] const ControlArray* allocateVisualPoints() const { return &pointsVisual; }
[[nodiscard]] const ControlArray& getPoints(bool visual) const { return visual ? pointsVisual : points;}
[[nodiscard]] index_type getPointCount() const { return points.size();}
[[nodiscard]] const Vector3& getPoint(index_type i, bool visual) const { return visual ? pointsVisual[i] : points[i];}
/** Initializes spline. Don't call other methods while spline not initialized. */
void init_spline(const Vector3* controls, index_type count, EvaluationMode m);
@@ -121,9 +121,9 @@ namespace Movement
void clear();
/** Calculates distance between [i; i+1] points, assumes that index i is in bounds. */
float SegLength(index_type i) const { return (this->*seglengths[m_mode])(i);}
[[nodiscard]] float SegLength(index_type i) const { return (this->*seglengths[m_mode])(i);}
std::string ToString() const;
[[nodiscard]] std::string ToString() const;
};
template<typename length_type>
@@ -136,7 +136,7 @@ namespace Movement
LengthArray lengths;
index_type computeIndexInBounds(length_type length) const;
[[nodiscard]] index_type computeIndexInBounds(length_type length) const;
public:
explicit Spline() {}
@@ -160,7 +160,7 @@ namespace Movement
void evaluate_derivative(index_type Idx, float u, Vector3& c) const { SplineBase::evaluate_derivative(Idx, u, c);}
// Assumes that t in range [0, 1]
index_type computeIndexInBounds(float t) const;
[[nodiscard]] index_type computeIndexInBounds(float t) const;
void computeIndex(float t, index_type& out_idx, float& out_u) const;
/** Initializes spline. Don't call other methods while spline not initialized. */
@@ -191,10 +191,10 @@ namespace Movement
}
/** Returns length of the whole spline. */
length_type length() const { return lengths[index_hi];}
[[nodiscard]] length_type length() const { return lengths[index_hi];}
/** Returns length between given nodes. */
length_type length(index_type first, index_type last) const { return lengths[last] - lengths[first];}
length_type length(index_type Idx) const { return lengths[Idx];}
[[nodiscard]] length_type length(index_type first, index_type last) const { return lengths[last] - lengths[first];}
[[nodiscard]] length_type length(index_type Idx) const { return lengths[Idx];}
void set_length(index_type i, length_type length) { lengths[i] = length;}
void clear();

View File

@@ -201,82 +201,82 @@ public:
uint32 XPValue(Player* player) const;
bool HasFlag(uint32 flag) const { return (Flags & flag) != 0; }
[[nodiscard]] bool HasFlag(uint32 flag) const { return (Flags & flag) != 0; }
void SetFlag(uint32 flag) { Flags |= flag; }
bool HasSpecialFlag(uint32 flag) const { return (SpecialFlags & flag) != 0; }
[[nodiscard]] bool HasSpecialFlag(uint32 flag) const { return (SpecialFlags & flag) != 0; }
void SetSpecialFlag(uint32 flag) { SpecialFlags |= flag; }
// table data accessors:
uint32 GetQuestId() const { return Id; }
uint32 GetQuestMethod() const { return Method; }
int32 GetZoneOrSort() const { return ZoneOrSort; }
uint32 GetMinLevel() const { return MinLevel; }
uint32 GetMaxLevel() const { return MaxLevel; }
int32 GetQuestLevel() const { return Level; }
uint32 GetType() const { return Type; }
uint32 GetRequiredClasses() const { return RequiredClasses; }
uint32 GetAllowableRaces() const { return AllowableRaces; }
uint32 GetRequiredSkill() const { return RequiredSkillId; }
uint32 GetRequiredSkillValue() const { return RequiredSkillPoints; }
uint32 GetRepObjectiveFaction() const { return RequiredFactionId1; }
int32 GetRepObjectiveValue() const { return RequiredFactionValue1; }
uint32 GetRepObjectiveFaction2() const { return RequiredFactionId2; }
int32 GetRepObjectiveValue2() const { return RequiredFactionValue2; }
uint32 GetRequiredMinRepFaction() const { return RequiredMinRepFaction; }
int32 GetRequiredMinRepValue() const { return RequiredMinRepValue; }
uint32 GetRequiredMaxRepFaction() const { return RequiredMaxRepFaction; }
int32 GetRequiredMaxRepValue() const { return RequiredMaxRepValue; }
uint32 GetSuggestedPlayers() const { return SuggestedPlayers; }
uint32 GetTimeAllowed() const { return TimeAllowed; }
int32 GetPrevQuestId() const { return PrevQuestId; }
uint32 GetNextQuestId() const { return NextQuestId; }
int32 GetExclusiveGroup() const { return ExclusiveGroup; }
uint32 GetNextQuestInChain() const { return RewardNextQuest; }
uint32 GetCharTitleId() const { return RewardTitleId; }
uint32 GetPlayersSlain() const { return RequiredPlayerKills; }
uint32 GetBonusTalents() const { return RewardTalents; }
int32 GetRewArenaPoints() const {return RewardArenaPoints; }
uint32 GetXPId() const { return RewardXPDifficulty; }
uint32 GetSrcItemId() const { return StartItem; }
uint32 GetSrcItemCount() const { return StartItemCount; }
uint32 GetSrcSpell() const { return SourceSpellid; }
std::string const& GetTitle() const { return Title; }
std::string const& GetDetails() const { return Details; }
std::string const& GetObjectives() const { return Objectives; }
std::string const& GetOfferRewardText() const { return OfferRewardText; }
std::string const& GetRequestItemsText() const { return RequestItemsText; }
std::string const& GetAreaDescription() const { return AreaDescription; }
std::string const& GetCompletedText() const { return CompletedText; }
int32 GetRewOrReqMoney() const;
uint32 GetRewHonorAddition() const { return RewardHonor; }
float GetRewHonorMultiplier() const { return RewardKillHonor; }
uint32 GetRewMoneyMaxLevel() const; // use in XP calculation at client
uint32 GetRewSpell() const { return RewardDisplaySpell; }
int32 GetRewSpellCast() const { return RewardSpell; }
uint32 GetRewMailTemplateId() const { return RewardMailTemplateId; }
uint32 GetRewMailDelaySecs() const { return RewardMailDelay; }
uint32 GetRewMailSenderEntry() const { return RewardMailSenderEntry; }
uint32 GetPOIContinent() const { return POIContinent; }
float GetPOIx() const { return POIx; }
float GetPOIy() const { return POIy; }
uint32 GetPointOpt() const { return POIPriority; }
uint32 GetIncompleteEmote() const { return EmoteOnIncomplete; }
uint32 GetCompleteEmote() const { return EmoteOnComplete; }
bool IsRepeatable() const { return SpecialFlags & QUEST_SPECIAL_FLAGS_REPEATABLE; }
bool IsAutoAccept() const;
bool IsAutoComplete() const;
uint32 GetFlags() const { return Flags; }
bool IsDaily() const { return Flags & QUEST_FLAGS_DAILY; }
bool IsWeekly() const { return Flags & QUEST_FLAGS_WEEKLY; }
bool IsMonthly() const { return SpecialFlags & QUEST_SPECIAL_FLAGS_MONTHLY; }
bool IsSeasonal() const { return (ZoneOrSort == -QUEST_SORT_SEASONAL || ZoneOrSort == -QUEST_SORT_SPECIAL || ZoneOrSort == -QUEST_SORT_LUNAR_FESTIVAL || ZoneOrSort == -QUEST_SORT_MIDSUMMER || ZoneOrSort == -QUEST_SORT_BREWFEST || ZoneOrSort == -QUEST_SORT_LOVE_IS_IN_THE_AIR || ZoneOrSort == -QUEST_SORT_NOBLEGARDEN) && !IsRepeatable(); }
bool IsDailyOrWeekly() const { return Flags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); }
bool IsRaidQuest(Difficulty difficulty) const;
bool IsAllowedInRaid(Difficulty difficulty) const;
bool IsDFQuest() const { return SpecialFlags & QUEST_SPECIAL_FLAGS_DF_QUEST; }
bool IsPVPQuest() const { return Type == QUEST_TYPE_PVP; }
uint32 CalculateHonorGain(uint8 level) const;
[[nodiscard]] uint32 GetQuestId() const { return Id; }
[[nodiscard]] uint32 GetQuestMethod() const { return Method; }
[[nodiscard]] int32 GetZoneOrSort() const { return ZoneOrSort; }
[[nodiscard]] uint32 GetMinLevel() const { return MinLevel; }
[[nodiscard]] uint32 GetMaxLevel() const { return MaxLevel; }
[[nodiscard]] int32 GetQuestLevel() const { return Level; }
[[nodiscard]] uint32 GetType() const { return Type; }
[[nodiscard]] uint32 GetRequiredClasses() const { return RequiredClasses; }
[[nodiscard]] uint32 GetAllowableRaces() const { return AllowableRaces; }
[[nodiscard]] uint32 GetRequiredSkill() const { return RequiredSkillId; }
[[nodiscard]] uint32 GetRequiredSkillValue() const { return RequiredSkillPoints; }
[[nodiscard]] uint32 GetRepObjectiveFaction() const { return RequiredFactionId1; }
[[nodiscard]] int32 GetRepObjectiveValue() const { return RequiredFactionValue1; }
[[nodiscard]] uint32 GetRepObjectiveFaction2() const { return RequiredFactionId2; }
[[nodiscard]] int32 GetRepObjectiveValue2() const { return RequiredFactionValue2; }
[[nodiscard]] uint32 GetRequiredMinRepFaction() const { return RequiredMinRepFaction; }
[[nodiscard]] int32 GetRequiredMinRepValue() const { return RequiredMinRepValue; }
[[nodiscard]] uint32 GetRequiredMaxRepFaction() const { return RequiredMaxRepFaction; }
[[nodiscard]] int32 GetRequiredMaxRepValue() const { return RequiredMaxRepValue; }
[[nodiscard]] uint32 GetSuggestedPlayers() const { return SuggestedPlayers; }
[[nodiscard]] uint32 GetTimeAllowed() const { return TimeAllowed; }
[[nodiscard]] int32 GetPrevQuestId() const { return PrevQuestId; }
[[nodiscard]] uint32 GetNextQuestId() const { return NextQuestId; }
[[nodiscard]] int32 GetExclusiveGroup() const { return ExclusiveGroup; }
[[nodiscard]] uint32 GetNextQuestInChain() const { return RewardNextQuest; }
[[nodiscard]] uint32 GetCharTitleId() const { return RewardTitleId; }
[[nodiscard]] uint32 GetPlayersSlain() const { return RequiredPlayerKills; }
[[nodiscard]] uint32 GetBonusTalents() const { return RewardTalents; }
[[nodiscard]] int32 GetRewArenaPoints() const {return RewardArenaPoints; }
[[nodiscard]] uint32 GetXPId() const { return RewardXPDifficulty; }
[[nodiscard]] uint32 GetSrcItemId() const { return StartItem; }
[[nodiscard]] uint32 GetSrcItemCount() const { return StartItemCount; }
[[nodiscard]] uint32 GetSrcSpell() const { return SourceSpellid; }
[[nodiscard]] std::string const& GetTitle() const { return Title; }
[[nodiscard]] std::string const& GetDetails() const { return Details; }
[[nodiscard]] std::string const& GetObjectives() const { return Objectives; }
[[nodiscard]] std::string const& GetOfferRewardText() const { return OfferRewardText; }
[[nodiscard]] std::string const& GetRequestItemsText() const { return RequestItemsText; }
[[nodiscard]] std::string const& GetAreaDescription() const { return AreaDescription; }
[[nodiscard]] std::string const& GetCompletedText() const { return CompletedText; }
[[nodiscard]] int32 GetRewOrReqMoney() const;
[[nodiscard]] uint32 GetRewHonorAddition() const { return RewardHonor; }
[[nodiscard]] float GetRewHonorMultiplier() const { return RewardKillHonor; }
[[nodiscard]] uint32 GetRewMoneyMaxLevel() const; // use in XP calculation at client
[[nodiscard]] uint32 GetRewSpell() const { return RewardDisplaySpell; }
[[nodiscard]] int32 GetRewSpellCast() const { return RewardSpell; }
[[nodiscard]] uint32 GetRewMailTemplateId() const { return RewardMailTemplateId; }
[[nodiscard]] uint32 GetRewMailDelaySecs() const { return RewardMailDelay; }
[[nodiscard]] uint32 GetRewMailSenderEntry() const { return RewardMailSenderEntry; }
[[nodiscard]] uint32 GetPOIContinent() const { return POIContinent; }
[[nodiscard]] float GetPOIx() const { return POIx; }
[[nodiscard]] float GetPOIy() const { return POIy; }
[[nodiscard]] uint32 GetPointOpt() const { return POIPriority; }
[[nodiscard]] uint32 GetIncompleteEmote() const { return EmoteOnIncomplete; }
[[nodiscard]] uint32 GetCompleteEmote() const { return EmoteOnComplete; }
[[nodiscard]] bool IsRepeatable() const { return SpecialFlags & QUEST_SPECIAL_FLAGS_REPEATABLE; }
[[nodiscard]] bool IsAutoAccept() const;
[[nodiscard]] bool IsAutoComplete() const;
[[nodiscard]] uint32 GetFlags() const { return Flags; }
[[nodiscard]] bool IsDaily() const { return Flags & QUEST_FLAGS_DAILY; }
[[nodiscard]] bool IsWeekly() const { return Flags & QUEST_FLAGS_WEEKLY; }
[[nodiscard]] bool IsMonthly() const { return SpecialFlags & QUEST_SPECIAL_FLAGS_MONTHLY; }
[[nodiscard]] bool IsSeasonal() const { return (ZoneOrSort == -QUEST_SORT_SEASONAL || ZoneOrSort == -QUEST_SORT_SPECIAL || ZoneOrSort == -QUEST_SORT_LUNAR_FESTIVAL || ZoneOrSort == -QUEST_SORT_MIDSUMMER || ZoneOrSort == -QUEST_SORT_BREWFEST || ZoneOrSort == -QUEST_SORT_LOVE_IS_IN_THE_AIR || ZoneOrSort == -QUEST_SORT_NOBLEGARDEN) && !IsRepeatable(); }
[[nodiscard]] bool IsDailyOrWeekly() const { return Flags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); }
[[nodiscard]] bool IsRaidQuest(Difficulty difficulty) const;
[[nodiscard]] bool IsAllowedInRaid(Difficulty difficulty) const;
[[nodiscard]] bool IsDFQuest() const { return SpecialFlags & QUEST_SPECIAL_FLAGS_DF_QUEST; }
[[nodiscard]] bool IsPVPQuest() const { return Type == QUEST_TYPE_PVP; }
[[nodiscard]] uint32 CalculateHonorGain(uint8 level) const;
// multiple values
std::string ObjectiveText[QUEST_OBJECTIVES_COUNT];
@@ -298,10 +298,10 @@ public:
uint32 OfferRewardEmote[QUEST_EMOTE_COUNT];
uint32 OfferRewardEmoteDelay[QUEST_EMOTE_COUNT];
uint32 GetReqItemsCount() const { return _reqItemsCount; }
uint32 GetReqCreatureOrGOcount() const { return _reqCreatureOrGOcount; }
uint32 GetRewChoiceItemsCount() const { return _rewChoiceItemsCount; }
uint32 GetRewItemsCount() const { return _rewItemsCount; }
[[nodiscard]] uint32 GetReqItemsCount() const { return _reqItemsCount; }
[[nodiscard]] uint32 GetReqCreatureOrGOcount() const { return _reqCreatureOrGOcount; }
[[nodiscard]] uint32 GetRewChoiceItemsCount() const { return _rewChoiceItemsCount; }
[[nodiscard]] uint32 GetRewItemsCount() const { return _rewItemsCount; }
typedef std::vector<int32> PrevQuests;
PrevQuests prevQuests;
@@ -312,7 +312,7 @@ public:
void InitializeQueryData(); // pussywizard
void SetEventIdForQuest(uint16 eventId) { _eventIdForQuest = eventId; }
uint16 GetEventIdForQuest() const { return _eventIdForQuest; }
[[nodiscard]] uint16 GetEventIdForQuest() const { return _eventIdForQuest; }
// cached data
private:

View File

@@ -151,11 +151,11 @@ public:
// Do not override this in scripts; it should be overridden by the various script type classes. It indicates
// whether or not this script type must be assigned in the database.
virtual bool IsDatabaseBound() const { return false; }
virtual bool isAfterLoadScript() const { return IsDatabaseBound(); }
[[nodiscard]] virtual bool IsDatabaseBound() const { return false; }
[[nodiscard]] virtual bool isAfterLoadScript() const { return IsDatabaseBound(); }
virtual void checkValidity() { }
const std::string& GetName() const { return _name; }
[[nodiscard]] const std::string& GetName() const { return _name; }
protected:
@@ -194,13 +194,13 @@ protected:
public:
bool IsDatabaseBound() const override { return true; }
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
// Should return a fully valid SpellScript pointer.
virtual SpellScript* GetSpellScript() const { return nullptr; }
[[nodiscard]] virtual SpellScript* GetSpellScript() const { return nullptr; }
// Should return a fully valid AuraScript pointer.
virtual AuraScript* GetAuraScript() const { return nullptr; }
[[nodiscard]] virtual AuraScript* GetAuraScript() const { return nullptr; }
};
class ServerScript : public ScriptObject
@@ -359,7 +359,7 @@ protected:
public:
bool isAfterLoadScript() const override { return true; }
[[nodiscard]] bool isAfterLoadScript() const override { return true; }
void checkValidity() override
{
@@ -378,7 +378,7 @@ protected:
public:
bool IsDatabaseBound() const override { return true; }
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
void checkValidity() override
{
@@ -400,7 +400,7 @@ protected:
public:
bool isAfterLoadScript() const override { return true; }
[[nodiscard]] bool isAfterLoadScript() const override { return true; }
void checkValidity() override
{
@@ -419,7 +419,7 @@ protected:
public:
bool IsDatabaseBound() const override { return true; }
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
// Called when a player accepts a quest from the item.
virtual bool OnQuestAccept(Player* /*player*/, Item* /*item*/, Quest const* /*quest*/) { return false; }
@@ -525,7 +525,7 @@ protected:
public:
bool IsDatabaseBound() const override { return true; }
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
// Called when a player opens a gossip dialog with the creature.
virtual bool OnGossipHello(Player* /*player*/, Creature* /*creature*/) { return false; }
@@ -563,7 +563,7 @@ protected:
public:
bool IsDatabaseBound() const override { return true; }
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
// Called when a player opens a gossip dialog with the gameobject.
virtual bool OnGossipHello(Player* /*player*/, GameObject* /*go*/) { return false; }
@@ -607,7 +607,7 @@ protected:
public:
bool IsDatabaseBound() const override { return true; }
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
// Called when the area trigger is activated by a player.
virtual bool OnTrigger(Player* /*player*/, AreaTrigger const* /*trigger*/) { return false; }
@@ -621,10 +621,10 @@ protected:
public:
bool IsDatabaseBound() const override { return true; }
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
// Should return a fully valid Battleground object for the type ID.
virtual Battleground* GetBattleground() const = 0;
[[nodiscard]] virtual Battleground* GetBattleground() const = 0;
};
@@ -636,10 +636,10 @@ protected:
public:
bool IsDatabaseBound() const override { return true; }
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
// Should return a fully valid OutdoorPvP object for the type ID.
virtual OutdoorPvP* GetOutdoorPvP() const = 0;
[[nodiscard]] virtual OutdoorPvP* GetOutdoorPvP() const = 0;
};
class CommandScript : public ScriptObject
@@ -651,7 +651,7 @@ protected:
public:
// Should return a pointer to a valid command table (ChatCommand array) to be used by ChatHandler.
virtual std::vector<ChatCommand> GetCommands() const = 0;
[[nodiscard]] virtual std::vector<ChatCommand> GetCommands() const = 0;
};
class WeatherScript : public ScriptObject, public UpdatableScript<Weather>
@@ -662,7 +662,7 @@ protected:
public:
bool IsDatabaseBound() const override { return true; }
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
// Called when the weather changes in the zone this script is associated with.
virtual void OnChange(Weather* /*weather*/, WeatherState /*state*/, float /*grade*/) { }
@@ -718,7 +718,7 @@ protected:
public:
bool IsDatabaseBound() const override { return true; }
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
// Called when a single condition is checked for a player.
virtual bool OnConditionCheck(Condition* /*condition*/, ConditionSourceInfo& /*sourceInfo*/) { return true; }
@@ -766,7 +766,7 @@ protected:
public:
bool IsDatabaseBound() const override { return true; }
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
// Called when a player boards the transport.
virtual void OnAddPassenger(Transport* /*transport*/, Player* /*player*/) { }
@@ -789,7 +789,7 @@ protected:
public:
bool IsDatabaseBound() const override { return true; }
[[nodiscard]] bool IsDatabaseBound() const override { return true; }
// deprecated/legacy
virtual bool OnCheck(Player* /*source*/, Unit* /*target*/) { return true; };
@@ -1050,7 +1050,7 @@ protected:
public:
bool IsDatabaseBound() const override { return false; }
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
// Called when a member is added to the guild.
virtual void OnAddMember(Guild* /*guild*/, Player* /*player*/, uint8& /*plRank*/) { }
@@ -1093,7 +1093,7 @@ protected:
public:
bool IsDatabaseBound() const override { return false; }
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
// Called when a member is added to a group.
virtual void OnAddMember(Group* /*group*/, uint64 /*guid*/) { }
@@ -1150,7 +1150,7 @@ protected:
public:
bool IsDatabaseBound() const override { return false; }
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
// Start Battlegroud
virtual void OnBattlegroundStart(Battleground* /*bg*/) { }
@@ -1188,7 +1188,7 @@ protected:
ArenaTeamScript(const char* name);
public:
bool IsDatabaseBound() const override { return false; };
[[nodiscard]] bool IsDatabaseBound() const override { return false; };
virtual void OnGetSlotByType(const uint32 /*type*/, uint8& /*slot*/) {}
virtual void OnGetArenaPoints(ArenaTeam* /*team*/, float& /*points*/) {}
@@ -1205,7 +1205,7 @@ protected:
public:
bool IsDatabaseBound() const override { return false; }
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
// Calculate max duration in applying aura
virtual void OnCalcMaxDuration(Aura const* /*aura*/, int32& /*maxDuration*/) { }

View File

@@ -123,7 +123,7 @@ public:
virtual ~PacketFilter() {}
virtual bool Process(WorldPacket* /*packet*/) { return true; }
virtual bool ProcessLogout() const { return true; }
[[nodiscard]] virtual bool ProcessLogout() const { return true; }
protected:
WorldSession* const m_pSession;
@@ -137,7 +137,7 @@ public:
bool Process(WorldPacket* packet) override;
//in Map::Update() we do not process player logout!
bool ProcessLogout() const override { return false; }
[[nodiscard]] bool ProcessLogout() const override { return false; }
};
//class used to filer only thread-unsafe packets from queue

View File

@@ -455,7 +455,7 @@ public:
auras[petEntry] = aura;
}
uint32 GetAura(uint32 petEntry) const
[[nodiscard]] uint32 GetAura(uint32 petEntry) const
{
PetAuraMap::const_iterator itr = auras.find(petEntry);
if (itr != auras.end())
@@ -471,12 +471,12 @@ public:
auras[petEntry] = aura;
}
bool IsRemovedOnChangePet() const
[[nodiscard]] bool IsRemovedOnChangePet() const
{
return removeOnChangePet;
}
int32 GetDamage() const
[[nodiscard]] int32 GetDamage() const
{
return damage;
}
@@ -615,81 +615,81 @@ public:
static bool CheckSpellValid(SpellInfo const* spellInfo, uint32 spellId, bool isTalent);
// Spell difficulty
uint32 GetSpellDifficultyId(uint32 spellId) const;
[[nodiscard]] uint32 GetSpellDifficultyId(uint32 spellId) const;
void SetSpellDifficultyId(uint32 spellId, uint32 id);
uint32 GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) const;
SpellInfo const* GetSpellForDifficultyFromSpell(SpellInfo const* spell, Unit const* caster) const;
// Spell Ranks table
SpellChainNode const* GetSpellChainNode(uint32 spell_id) const;
uint32 GetFirstSpellInChain(uint32 spell_id) const;
uint32 GetLastSpellInChain(uint32 spell_id) const;
uint32 GetNextSpellInChain(uint32 spell_id) const;
uint32 GetPrevSpellInChain(uint32 spell_id) const;
uint8 GetSpellRank(uint32 spell_id) const;
[[nodiscard]] SpellChainNode const* GetSpellChainNode(uint32 spell_id) const;
[[nodiscard]] uint32 GetFirstSpellInChain(uint32 spell_id) const;
[[nodiscard]] uint32 GetLastSpellInChain(uint32 spell_id) const;
[[nodiscard]] uint32 GetNextSpellInChain(uint32 spell_id) const;
[[nodiscard]] uint32 GetPrevSpellInChain(uint32 spell_id) const;
[[nodiscard]] uint8 GetSpellRank(uint32 spell_id) const;
// not strict check returns provided spell if rank not avalible
uint32 GetSpellWithRank(uint32 spell_id, uint32 rank, bool strict = false) const;
[[nodiscard]] uint32 GetSpellWithRank(uint32 spell_id, uint32 rank, bool strict = false) const;
// Spell Required table
SpellRequiredMapBounds GetSpellsRequiredForSpellBounds(uint32 spell_id) const;
SpellsRequiringSpellMapBounds GetSpellsRequiringSpellBounds(uint32 spell_id) const;
bool IsSpellRequiringSpell(uint32 spellid, uint32 req_spellid) const;
[[nodiscard]] SpellRequiredMapBounds GetSpellsRequiredForSpellBounds(uint32 spell_id) const;
[[nodiscard]] SpellsRequiringSpellMapBounds GetSpellsRequiringSpellBounds(uint32 spell_id) const;
[[nodiscard]] bool IsSpellRequiringSpell(uint32 spellid, uint32 req_spellid) const;
// Spell learning
SpellLearnSkillNode const* GetSpellLearnSkill(uint32 spell_id) const;
[[nodiscard]] SpellLearnSkillNode const* GetSpellLearnSkill(uint32 spell_id) const;
// Spell target coordinates
SpellTargetPosition const* GetSpellTargetPosition(uint32 spell_id, SpellEffIndex effIndex) const;
[[nodiscard]] SpellTargetPosition const* GetSpellTargetPosition(uint32 spell_id, SpellEffIndex effIndex) const;
// Spell Groups
uint32 GetSpellGroup(uint32 spellid) const;
SpellGroupSpecialFlags GetSpellGroupSpecialFlags(uint32 spell_id) const;
SpellGroupStackFlags GetGroupStackFlags(uint32 groupid) const;
[[nodiscard]] uint32 GetSpellGroup(uint32 spellid) const;
[[nodiscard]] SpellGroupSpecialFlags GetSpellGroupSpecialFlags(uint32 spell_id) const;
[[nodiscard]] SpellGroupStackFlags GetGroupStackFlags(uint32 groupid) const;
SpellGroupStackFlags CheckSpellGroupStackRules(SpellInfo const* spellInfo1, SpellInfo const* spellInfo2, bool remove, bool areaAura) const;
void GetSetOfSpellsInSpellGroupWithFlag(uint32 group_id, SpellGroupSpecialFlags flag, std::set<uint32>& availableElixirs) const;
// Spell proc event table
SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const;
[[nodiscard]] SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const;
bool IsSpellProcEventCanTriggeredBy(SpellInfo const* spellProto, SpellProcEventEntry const* spellProcEvent, uint32 EventProcFlag, SpellInfo const* procSpell, uint32 procFlags, uint32 procExtra, bool active) const;
// Spell proc table
SpellProcEntry const* GetSpellProcEntry(uint32 spellId) const;
[[nodiscard]] SpellProcEntry const* GetSpellProcEntry(uint32 spellId) const;
bool CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcEventInfo& eventInfo) const;
// Spell bonus data table
SpellBonusEntry const* GetSpellBonusData(uint32 spellId) const;
[[nodiscard]] SpellBonusEntry const* GetSpellBonusData(uint32 spellId) const;
// Spell threat table
SpellThreatEntry const* GetSpellThreatEntry(uint32 spellID) const;
[[nodiscard]] SpellThreatEntry const* GetSpellThreatEntry(uint32 spellID) const;
// Spell mixology table
float GetSpellMixologyBonus(uint32 spellId) const;
[[nodiscard]] float GetSpellMixologyBonus(uint32 spellId) const;
SkillLineAbilityMapBounds GetSkillLineAbilityMapBounds(uint32 spell_id) const;
[[nodiscard]] SkillLineAbilityMapBounds GetSkillLineAbilityMapBounds(uint32 spell_id) const;
PetAura const* GetPetAura(uint32 spell_id, uint8 eff) const;
[[nodiscard]] PetAura const* GetPetAura(uint32 spell_id, uint8 eff) const;
SpellEnchantProcEntry const* GetSpellEnchantProcEvent(uint32 enchId) const;
bool IsArenaAllowedEnchancment(uint32 ench_id) const;
[[nodiscard]] SpellEnchantProcEntry const* GetSpellEnchantProcEvent(uint32 enchId) const;
[[nodiscard]] bool IsArenaAllowedEnchancment(uint32 ench_id) const;
const std::vector<int32>* GetSpellLinked(int32 spell_id) const;
[[nodiscard]] const std::vector<int32>* GetSpellLinked(int32 spell_id) const;
PetLevelupSpellSet const* GetPetLevelupSpellList(uint32 petFamily) const;
PetDefaultSpellsEntry const* GetPetDefaultSpellsEntry(int32 id) const;
[[nodiscard]] PetLevelupSpellSet const* GetPetLevelupSpellList(uint32 petFamily) const;
[[nodiscard]] PetDefaultSpellsEntry const* GetPetDefaultSpellsEntry(int32 id) const;
// Spell area
SpellAreaMapBounds GetSpellAreaMapBounds(uint32 spell_id) const;
SpellAreaForQuestMapBounds GetSpellAreaForQuestMapBounds(uint32 quest_id) const;
SpellAreaForQuestMapBounds GetSpellAreaForQuestEndMapBounds(uint32 quest_id) const;
SpellAreaForAuraMapBounds GetSpellAreaForAuraMapBounds(uint32 spell_id) const;
SpellAreaForAreaMapBounds GetSpellAreaForAreaMapBounds(uint32 area_id) const;
[[nodiscard]] SpellAreaMapBounds GetSpellAreaMapBounds(uint32 spell_id) const;
[[nodiscard]] SpellAreaForQuestMapBounds GetSpellAreaForQuestMapBounds(uint32 quest_id) const;
[[nodiscard]] SpellAreaForQuestMapBounds GetSpellAreaForQuestEndMapBounds(uint32 quest_id) const;
[[nodiscard]] SpellAreaForAuraMapBounds GetSpellAreaForAuraMapBounds(uint32 spell_id) const;
[[nodiscard]] SpellAreaForAreaMapBounds GetSpellAreaForAreaMapBounds(uint32 area_id) const;
// SpellInfo object management
SpellInfo const* GetSpellInfo(uint32 spellId) const { return spellId < GetSpellInfoStoreSize() ? mSpellInfoMap[spellId] : nullptr; }
uint32 GetSpellInfoStoreSize() const { return mSpellInfoMap.size(); }
[[nodiscard]] SpellInfo const* GetSpellInfo(uint32 spellId) const { return spellId < GetSpellInfoStoreSize() ? mSpellInfoMap[spellId] : nullptr; }
[[nodiscard]] uint32 GetSpellInfoStoreSize() const { return mSpellInfoMap.size(); }
// Talent Additional Set
bool IsAdditionalTalentSpell(uint32 spellId) const;
[[nodiscard]] bool IsAdditionalTalentSpell(uint32 spellId) const;
private:
SpellInfo* _GetSpellInfo(uint32 spellId) { return spellId < GetSpellInfoStoreSize() ? mSpellInfoMap[spellId] : nullptr; }

View File

@@ -65,12 +65,12 @@ public:
void SetWeather(WeatherType type, float grade);
/// For which zone is this weather?
uint32 GetZone() const { return m_zone; };
uint32 GetScriptId() const { return m_weatherChances->ScriptId; }
[[nodiscard]] uint32 GetZone() const { return m_zone; };
[[nodiscard]] uint32 GetScriptId() const { return m_weatherChances->ScriptId; }
private:
WeatherState GetWeatherState() const;
[[nodiscard]] WeatherState GetWeatherState() const;
uint32 m_zone;
WeatherType m_type;
float m_grade;

View File

@@ -19,8 +19,8 @@ public:
DBCStorageBase(char const* fmt);
virtual ~DBCStorageBase();
char const* GetFormat() const { return _fileFormat; }
uint32 GetFieldCount() const { return _fieldCount; }
[[nodiscard]] char const* GetFormat() const { return _fileFormat; }
[[nodiscard]] uint32 GetFieldCount() const { return _fieldCount; }
virtual bool Load(char const* path) = 0;
virtual bool LoadStringsFrom(char const* path) = 0;
@@ -54,8 +54,8 @@ public:
delete[] reinterpret_cast<char*>(_indexTable.AsT);
}
T const* LookupEntry(uint32 id) const { return (id >= _indexTableSize) ? nullptr : _indexTable.AsT[id]; }
T const* AssertEntry(uint32 id) const { return ASSERT_NOTNULL(LookupEntry(id)); }
[[nodiscard]] T const* LookupEntry(uint32 id) const { return (id >= _indexTableSize) ? nullptr : _indexTable.AsT[id]; }
[[nodiscard]] T const* AssertEntry(uint32 id) const { return ASSERT_NOTNULL(LookupEntry(id)); }
#ifdef ELUNA
void SetEntry(uint32 id, T* t)
@@ -78,7 +78,7 @@ public:
}
#endif
uint32 GetNumRows() const { return _indexTableSize; }
[[nodiscard]] uint32 GetNumRows() const { return _indexTableSize; }
bool Load(char const* path) override
{

View File

@@ -516,7 +516,7 @@ struct AreaTableEntry
uint32 LiquidTypeOverride[4]; // 29-32 liquid override by type
// helpers
bool IsSanctuary() const
[[nodiscard]] bool IsSanctuary() const
{
if (mapid == 609)
return true;
@@ -524,7 +524,7 @@ struct AreaTableEntry
}
// Xinef: mark some zones / areas as inns
bool IsInn(TeamId teamId) const
[[nodiscard]] bool IsInn(TeamId teamId) const
{
if (teamId == TEAM_ALLIANCE)
return flags & AREA_FLAG_REST_ZONE_ALLIANCE;
@@ -877,7 +877,7 @@ struct FactionEntry
// 56 string flags
// helpers
bool CanHaveReputation() const
[[nodiscard]] bool CanHaveReputation() const
{
return reputationListID >= 0;
}
@@ -898,7 +898,7 @@ struct FactionTemplateEntry
//------------------------------------------------------- end structure
// helpers
bool IsFriendlyTo(FactionTemplateEntry const& entry) const
[[nodiscard]] bool IsFriendlyTo(FactionTemplateEntry const& entry) const
{
// Xinef: Always friendly to self faction
if (faction == entry.faction)
@@ -915,7 +915,7 @@ struct FactionTemplateEntry
}
return (friendlyMask & entry.ourMask) || (ourMask & entry.friendlyMask);
}
bool IsHostileTo(FactionTemplateEntry const& entry) const
[[nodiscard]] bool IsHostileTo(FactionTemplateEntry const& entry) const
{
if (entry.faction)
{
@@ -928,15 +928,15 @@ struct FactionTemplateEntry
}
return (hostileMask & entry.ourMask) != 0;
}
bool IsHostileToPlayers() const { return (hostileMask & FACTION_MASK_PLAYER) != 0; }
bool IsNeutralToAll() const
[[nodiscard]] bool IsHostileToPlayers() const { return (hostileMask & FACTION_MASK_PLAYER) != 0; }
[[nodiscard]] bool IsNeutralToAll() const
{
for (uint8 i = 0; i < MAX_FACTION_RELATIONS; ++i)
if (enemyFaction[i] != 0)
return false;
return hostileMask == 0 && friendlyMask == 0;
}
bool IsContestedGuardFaction() const { return (factionFlags & FACTION_TEMPLATE_FLAG_CONTESTED_GUARD) != 0; }
[[nodiscard]] bool IsContestedGuardFaction() const { return (factionFlags & FACTION_TEMPLATE_FLAG_CONTESTED_GUARD) != 0; }
};
struct GameObjectDisplayInfoEntry
@@ -1189,7 +1189,7 @@ struct LFGDungeonEntry
uint32 grouptype; // 31
//char* desc[16]; // 32-47 Description
// Helpers
uint32 Entry() const { return ID + (type << 24); }
[[nodiscard]] uint32 Entry() const { return ID + (type << 24); }
};
struct LightEntry
@@ -1278,16 +1278,16 @@ struct MapEntry
uint32 maxPlayers; // 65 max players, fallback if not present in MapDifficulty.dbc
// Helpers
uint32 Expansion() const { return addon; }
[[nodiscard]] uint32 Expansion() const { return addon; }
bool IsDungeon() const { return map_type == MAP_INSTANCE || map_type == MAP_RAID; }
bool IsNonRaidDungeon() const { return map_type == MAP_INSTANCE; }
bool Instanceable() const { return map_type == MAP_INSTANCE || map_type == MAP_RAID || map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; }
bool IsRaid() const { return map_type == MAP_RAID; }
bool IsBattleground() const { return map_type == MAP_BATTLEGROUND; }
bool IsBattleArena() const { return map_type == MAP_ARENA; }
bool IsBattlegroundOrArena() const { return map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; }
bool IsWorldMap() const { return map_type == MAP_COMMON; }
[[nodiscard]] bool IsDungeon() const { return map_type == MAP_INSTANCE || map_type == MAP_RAID; }
[[nodiscard]] bool IsNonRaidDungeon() const { return map_type == MAP_INSTANCE; }
[[nodiscard]] bool Instanceable() const { return map_type == MAP_INSTANCE || map_type == MAP_RAID || map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; }
[[nodiscard]] bool IsRaid() const { return map_type == MAP_RAID; }
[[nodiscard]] bool IsBattleground() const { return map_type == MAP_BATTLEGROUND; }
[[nodiscard]] bool IsBattleArena() const { return map_type == MAP_ARENA; }
[[nodiscard]] bool IsBattlegroundOrArena() const { return map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; }
[[nodiscard]] bool IsWorldMap() const { return map_type == MAP_COMMON; }
bool GetEntrancePos(int32& mapid, float& x, float& y) const
{
@@ -1299,12 +1299,12 @@ struct MapEntry
return true;
}
bool IsContinent() const
[[nodiscard]] bool IsContinent() const
{
return MapID == 0 || MapID == 1 || MapID == 530 || MapID == 571;
}
bool IsDynamicDifficultyMap() const { return Flags & MAP_FLAG_DYNAMIC_DIFFICULTY; }
[[nodiscard]] bool IsDynamicDifficultyMap() const { return Flags & MAP_FLAG_DYNAMIC_DIFFICULTY; }
};
struct MapDifficultyEntry
@@ -1356,7 +1356,7 @@ struct PvPDifficultyEntry
// helpers
PvPDifficultyEntry(uint32 mapId, uint32 bracketId, uint32 minLevel, uint32 maxLevel, uint32 difficulty) : mapId(mapId), bracketId(bracketId), minLevel(minLevel), maxLevel(maxLevel), difficulty(difficulty) {}
BattlegroundBracketId GetBracketId() const { return BattlegroundBracketId(bracketId); }
[[nodiscard]] BattlegroundBracketId GetBracketId() const { return BattlegroundBracketId(bracketId); }
};
struct QuestSortEntry
@@ -1407,7 +1407,7 @@ struct ScalingStatValuesEntry
uint32 ssdMultiplier3; // 18 3.3
uint32 armorMod2[5]; // 19-23 Armor for level
uint32 getssdMultiplier(uint32 mask) const
[[nodiscard]] uint32 getssdMultiplier(uint32 mask) const
{
if (mask & 0x4001F)
{
@@ -1421,7 +1421,7 @@ struct ScalingStatValuesEntry
return 0;
}
uint32 getArmorMod(uint32 mask) const
[[nodiscard]] uint32 getArmorMod(uint32 mask) const
{
if (mask & 0x00F801E0)
{
@@ -1439,7 +1439,7 @@ struct ScalingStatValuesEntry
return 0;
}
uint32 getDPSMod(uint32 mask) const
[[nodiscard]] uint32 getDPSMod(uint32 mask) const
{
if (mask & 0x7E00)
{
@@ -1453,13 +1453,13 @@ struct ScalingStatValuesEntry
return 0;
}
uint32 getSpellBonus(uint32 mask) const
[[nodiscard]] uint32 getSpellBonus(uint32 mask) const
{
if (mask & 0x00008000) return spellPower;
return 0;
}
uint32 getFeralBonus(uint32 mask) const // removed in 3.2.x?
[[nodiscard]] uint32 getFeralBonus(uint32 mask) const // removed in 3.2.x?
{
if (mask & 0x00010000) return 0; // not used?
return 0;
@@ -1715,8 +1715,8 @@ struct SpellRuneCostEntry
uint32 RuneCost[3]; // 1-3 (0=blood, 1=frost, 2=unholy)
uint32 runePowerGain; // 4
bool NoRuneCost() const { return RuneCost[0] == 0 && RuneCost[1] == 0 && RuneCost[2] == 0; }
bool NoRunicPowerGain() const { return runePowerGain == 0; }
[[nodiscard]] bool NoRuneCost() const { return RuneCost[0] == 0 && RuneCost[1] == 0 && RuneCost[2] == 0; }
[[nodiscard]] bool NoRunicPowerGain() const { return runePowerGain == 0; }
};
#define MAX_SHAPESHIFT_SPELLS 8
@@ -1987,20 +1987,20 @@ struct VehicleSeatEntry
uint32 m_flagsB; // 45
// 46-57 added in 3.1, floats mostly
bool CanEnterOrExit() const
[[nodiscard]] bool CanEnterOrExit() const
{
return ((m_flags & VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT) != 0 ||
//If it has anmation for enter/ride, means it can be entered/exited by logic
(m_flags & (VEHICLE_SEAT_FLAG_HAS_LOWER_ANIM_FOR_ENTER | VEHICLE_SEAT_FLAG_HAS_LOWER_ANIM_FOR_RIDE)) != 0);
}
bool CanSwitchFromSeat() const { return m_flags & VEHICLE_SEAT_FLAG_CAN_SWITCH; }
bool IsUsableByOverride() const
[[nodiscard]] bool CanSwitchFromSeat() const { return m_flags & VEHICLE_SEAT_FLAG_CAN_SWITCH; }
[[nodiscard]] bool IsUsableByOverride() const
{
return (m_flags & (VEHICLE_SEAT_FLAG_UNCONTROLLED | VEHICLE_SEAT_FLAG_UNK18)
|| (m_flagsB & (VEHICLE_SEAT_FLAG_B_USABLE_FORCED | VEHICLE_SEAT_FLAG_B_USABLE_FORCED_2 |
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_3 | VEHICLE_SEAT_FLAG_B_USABLE_FORCED_4)));
}
bool IsEjectable() const { return m_flagsB & VEHICLE_SEAT_FLAG_B_EJECTABLE; }
[[nodiscard]] bool IsEjectable() const { return m_flagsB & VEHICLE_SEAT_FLAG_B_EJECTABLE; }
};
struct WMOAreaTableEntry

View File

@@ -33,16 +33,16 @@ public:
RealmSocket(void);
~RealmSocket(void) override;
size_t recv_len(void) const;
[[nodiscard]] size_t recv_len(void) const;
bool recv_soft(char* buf, size_t len);
bool recv(char* buf, size_t len);
void recv_skip(size_t len);
bool send(const char* buf, size_t len);
const std::string& getRemoteAddress(void) const;
[[nodiscard]] const std::string& getRemoteAddress(void) const;
uint16 getRemotePort(void) const;
[[nodiscard]] uint16 getRemotePort(void) const;
int open(void*) override;

View File

@@ -54,9 +54,9 @@ public:
void UpdateIfNeed();
void AddRealm(const Realm& NewRealm) { m_realms[NewRealm.name] = NewRealm; }
RealmMap::const_iterator begin() const { return m_realms.begin(); }
RealmMap::const_iterator end() const { return m_realms.end(); }
uint32 size() const { return m_realms.size(); }
[[nodiscard]] RealmMap::const_iterator begin() const { return m_realms.begin(); }
[[nodiscard]] RealmMap::const_iterator end() const { return m_realms.end(); }
[[nodiscard]] uint32 size() const { return m_realms.size(); }
private:
void UpdateRealms(bool init = false);

View File

@@ -41,22 +41,22 @@ public:
class Record
{
public:
float getFloat(size_t field) const
[[nodiscard]] float getFloat(size_t field) const
{
assert(field < file.fieldCount);
return *reinterpret_cast<float*>(offset + field * 4);
}
unsigned int getUInt(size_t field) const
[[nodiscard]] unsigned int getUInt(size_t field) const
{
assert(field < file.fieldCount);
return *reinterpret_cast<unsigned int*>(offset + field * 4);
}
int getInt(size_t field) const
[[nodiscard]] int getInt(size_t field) const
{
assert(field < file.fieldCount);
return *reinterpret_cast<int*>(offset + field * 4);
}
const char* getString(size_t field) const
[[nodiscard]] const char* getString(size_t field) const
{
assert(field < file.fieldCount);
size_t stringOffset = getUInt(field);
@@ -110,8 +110,8 @@ public:
/// Get begin iterator over records
Iterator end();
/// Trivial
size_t getRecordCount() const { return recordCount;}
size_t getFieldCount() const { return fieldCount; }
[[nodiscard]] size_t getRecordCount() const { return recordCount;}
[[nodiscard]] size_t getFieldCount() const { return fieldCount; }
size_t getMaxId();
private:
std::string filename;

View File

@@ -75,7 +75,7 @@ namespace MMAP
bool loadVMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData);
void loadOffMeshConnections(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, const char* offMeshFilePath);
bool usesLiquids() const { return !m_skipLiquid; }
[[nodiscard]] bool usesLiquids() const { return !m_skipLiquid; }
// vert and triangle methods
static void transform(std::vector<G3D::Vector3>& original, std::vector<G3D::Vector3>& transformed,

View File

@@ -53,27 +53,27 @@ public:
offset = r.offset;
return *this;
}
float getFloat(size_t field) const
[[nodiscard]] float getFloat(size_t field) const
{
assert(field < file.fieldCount);
return *reinterpret_cast<float*>(offset + field * 4);
}
unsigned int getUInt(size_t field) const
[[nodiscard]] unsigned int getUInt(size_t field) const
{
assert(field < file.fieldCount);
return *reinterpret_cast<unsigned int*>(offset + (field * 4));
}
int getInt(size_t field) const
[[nodiscard]] int getInt(size_t field) const
{
assert(field < file.fieldCount);
return *reinterpret_cast<int*>(offset + field * 4);
}
unsigned char getByte(size_t ofs) const
[[nodiscard]] unsigned char getByte(size_t ofs) const
{
assert(ofs < file.recordSize);
return *reinterpret_cast<unsigned char*>(offset + ofs);
}
const char* getString(size_t field) const
[[nodiscard]] const char* getString(size_t field) const
{
assert(field < file.fieldCount);
size_t stringOffset = getUInt(field);
@@ -129,8 +129,8 @@ public:
/// Get begin iterator over records
Iterator end();
/// Trivial
size_t getRecordCount() const { return recordCount;}
size_t getFieldCount() const { return fieldCount; }
[[nodiscard]] size_t getRecordCount() const { return recordCount;}
[[nodiscard]] size_t getFieldCount() const { return fieldCount; }
private:
std::string filename;

View File

@@ -85,12 +85,12 @@ public:
return *this;
}
float lengthSquared() const
[[nodiscard]] float lengthSquared() const
{
return x * x + y * y + z * z;
}
float length() const
[[nodiscard]] float length() const
{
return sqrt(x * x + y * y + z * z);
}
@@ -192,12 +192,12 @@ public:
return *this;
}
float lengthSquared() const
[[nodiscard]] float lengthSquared() const
{
return x * x + y * y;
}
float length() const
[[nodiscard]] float length() const
{
return sqrt(x * x + y * y);
}