NPCBots: Fix ranges sorting for bot containers 1

(cherry picked from TC commit d08321a758995cdc66be2eb63124b51e9f9a4739)
This commit is contained in:
trickerer
2025-11-12 10:43:42 +07:00
parent 8d0229b476
commit 5af06438fe
2 changed files with 6 additions and 4 deletions

View File

@@ -451,12 +451,13 @@ private:
struct BotInfo
{
explicit BotInfo(uint32 Id, std::string&& Name, uint8 Race) : id(Id), name(std::move(Name)), race(Race) {}
BotInfo(uint32 Id, std::string&& Name, uint8 Race) : id(Id), name(std::move(Name)), race(Race) {}
uint32 id;
std::string name;
uint8 race;
inline constexpr std::strong_ordering operator<=>(BotInfo const& other) const noexcept = default;
inline constexpr bool operator==(BotInfo const& other) const noexcept { return id == other.id; }
inline constexpr std::strong_ordering operator<=>(BotInfo const& other) const noexcept { return id <=> other.id; }
};
static char const* get_race_name(uint8 race)

View File

@@ -76,9 +76,10 @@ public:
WanderNode* wp;
uint32 weight;
inline uint32 Id() const { return wp ? wp->GetWPId() : 0; }
inline constexpr uint32 Id() const noexcept { return wp ? wp->GetWPId() : 0; }
inline constexpr std::strong_ordering operator<=>(WanderNodeLink const& other) const noexcept = default;
inline constexpr bool operator==(WanderNodeLink const& other) const noexcept { return Id() == other.Id(); }
inline constexpr std::strong_ordering operator<=>(WanderNodeLink const& other) const noexcept { return Id() <=> other.Id(); }
struct WeightExtractor {
inline constexpr uint32 operator()(WanderNodeLink const& wpl) const noexcept { return wpl.weight; }