aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/SmartScripts
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-08-24 11:48:45 +0200
committerShauren <shauren.trinity@gmail.com>2023-08-24 11:48:45 +0200
commit451314241dc40c4e3be600ef95a4f4fbd322f701 (patch)
tree1c55abe5e0027df578a792015254e4b95b8e6d80 /src/server/game/AI/SmartScripts
parent343d09bc95ade0cc34f953b56cbe666baca387fc (diff)
Core/Misc: Modernize comparison operators
(cherry picked from commit f0a862e71bc12d86a898901ef773475a7c964832)
Diffstat (limited to 'src/server/game/AI/SmartScripts')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 700fb8638dc..329f9f65de6 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -22,6 +22,7 @@
#include "EnumFlag.h"
#include "ObjectGuid.h"
#include "WaypointDefines.h"
+#include "advstd.h"
#include <limits>
#include <map>
#include <string>
@@ -1578,9 +1579,19 @@ struct SmartScriptHolder
operator bool() const { return entryOrGuid != 0; }
// Default comparision operator using priority field as first ordering field
- bool operator<(SmartScriptHolder const& other) const
+ std::strong_ordering operator<=>(SmartScriptHolder const& right) const
{
- return std::tie(priority, entryOrGuid, source_type, event_id, link) < std::tie(other.priority, other.entryOrGuid, other.source_type, other.event_id, other.link);
+ if (std::strong_ordering cmp = priority <=> right.priority; advstd::is_neq(cmp))
+ return cmp;
+ if (std::strong_ordering cmp = entryOrGuid <=> right.entryOrGuid; advstd::is_neq(cmp))
+ return cmp;
+ if (std::strong_ordering cmp = source_type <=> right.source_type; advstd::is_neq(cmp))
+ return cmp;
+ if (std::strong_ordering cmp = event_id <=> right.event_id; advstd::is_neq(cmp))
+ return cmp;
+ if (std::strong_ordering cmp = link <=> right.link; advstd::is_neq(cmp))
+ return cmp;
+ return std::strong_ordering::equal;
}
static constexpr uint32 DEFAULT_PRIORITY = std::numeric_limits<uint32>::max();