From acc65953ceaaf1cb876d2de94e33065e53d121b6 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 6 Sep 2021 22:15:59 -0400 Subject: [PATCH] Use tie for mtexinfo too --- include/qbsp/qbsp.hh | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/include/qbsp/qbsp.hh b/include/qbsp/qbsp.hh index fd5a7341..b62481a4 100644 --- a/include/qbsp/qbsp.hh +++ b/include/qbsp/qbsp.hh @@ -146,28 +146,17 @@ typedef struct mtexinfo_s { int32_t miptex; surfflags_t flags; int outputnum; // -1 until added to bsp + + constexpr auto as_tuple() const { + return std::tie(vecs, miptex, flags); + } - bool operator<(const mtexinfo_s &other) const { - if (this->miptex < other.miptex) - return true; - if (this->miptex > other.miptex) - return false; - - if (this->flags < other.flags) - return true; - if (this->flags > other.flags) - return false; - - for (int i=0; i<2; i++) { - for (int j=0; j<4; j++) { - if (this->vecs[i][j] < other.vecs[i][j]) - return true; - if (this->vecs[i][j] > other.vecs[i][j]) - return false; - } - } - - return false; + constexpr bool operator<(const mtexinfo_s &other) const { + return as_tuple() < other.as_tuple(); + } + + constexpr bool operator>(const mtexinfo_s &other) const { + return as_tuple() > other.as_tuple(); } } mtexinfo_t;