refactor(Core): apply clang-tidy modernize-use-nodiscard (#3835)
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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; }
|
||||
};
|
||||
|
||||
//==============================================================
|
||||
|
||||
Reference in New Issue
Block a user