aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/SmartScripts
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-04-06 17:46:58 +0200
committerShauren <shauren.trinity@gmail.com>2023-04-06 17:46:58 +0200
commit7b310802583a96dd32841bc396a119fca833e2d4 (patch)
tree990da6afe067b13ad0f24e33ed33c15adc5ad55d /src/server/game/AI/SmartScripts
parent74c280da9eac16c5d4a875ff2ea5aa30034ff1dd (diff)
Core/Misc: Modernize code a bit by replacing std::tie with either structured bindings or operator<=>
Diffstat (limited to 'src/server/game/AI/SmartScripts')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index d4af11f7dad..475b4ad4ad5 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -1643,9 +1643,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 (auto cmp = priority <=> right.priority; std::is_neq(cmp))
+ return cmp;
+ if (auto cmp = entryOrGuid <=> right.entryOrGuid; std::is_neq(cmp))
+ return cmp;
+ if (auto cmp = source_type <=> right.source_type; std::is_neq(cmp))
+ return cmp;
+ if (auto cmp = event_id <=> right.event_id; std::is_neq(cmp))
+ return cmp;
+ if (auto cmp = link <=> right.link; std::is_neq(cmp))
+ return cmp;
+ return std::strong_ordering::equal;
}
static constexpr uint32 DEFAULT_PRIORITY = std::numeric_limits<uint32>::max();