Use tie for operator</> of surfflags_t

This commit is contained in:
Jonathan 2021-09-06 22:12:44 -04:00
parent 437459a4dd
commit 9602772450
2 changed files with 14 additions and 3 deletions

View File

@ -386,6 +386,18 @@ struct surfflags_t {
minlight_color[1] || minlight_color[2] || phong_angle_concave ||
light_alpha;
}
constexpr auto as_tuple() const {
return std::tie(native, extended, phong_angle, minlight, minlight_color[0], minlight_color[1], minlight_color[2], phong_angle_concave, light_alpha);
}
constexpr bool operator<(const surfflags_t &other) const {
return as_tuple() < other.as_tuple();
}
constexpr bool operator>(const surfflags_t &other) const {
return as_tuple() > other.as_tuple();
}
};
// header before tightly packed surfflags_t[num_texinfo]

View File

@ -153,10 +153,9 @@ typedef struct mtexinfo_s {
if (this->miptex > other.miptex)
return false;
// CHECK: is it worth sorting by all members?
if (this->flags.native < other.flags.native)
if (this->flags < other.flags)
return true;
if (this->flags.native > other.flags.native)
if (this->flags > other.flags)
return false;
for (int i=0; i<2; i++) {