diff options
author | Shauren <shauren.trinity@gmail.com> | 2021-06-06 19:22:47 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-06-06 19:22:47 +0200 |
commit | 2f8e411ac7d357fdd861da2f3cfc9cc2542c2a40 (patch) | |
tree | 42126bd1870e3cbc0af1495e66938f8f163ce6cc /src/server/game/Reputation/ReputationMgr.cpp | |
parent | 8d5356cdeaeaae7dc20bfca71ca24b8134a8e80c (diff) |
Core/Reputation: Corrected sorting of friendship rep reactions
Diffstat (limited to 'src/server/game/Reputation/ReputationMgr.cpp')
-rw-r--r-- | src/server/game/Reputation/ReputationMgr.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index e662daf4a97..64ac0ba5544 100644 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -50,8 +50,8 @@ std::set<int32> const ReputationMgr::ReputationRankThresholds = const int32 ReputationMgr::Reputation_Cap = 42000; const int32 ReputationMgr::Reputation_Bottom = -42000; -template<typename T, typename F> -static int32 ReputationToRankHelper(std::set<T> const& thresholds, int32 standing, F thresholdExtractor) +template<typename T, typename F, typename... Rest> +static int32 ReputationToRankHelper(std::set<T, Rest...> const& thresholds, int32 standing, F thresholdExtractor) { auto itr = thresholds.begin(); auto end = thresholds.end(); @@ -68,7 +68,7 @@ static int32 ReputationToRankHelper(std::set<T> const& thresholds, int32 standin ReputationRank ReputationMgr::ReputationToRank(FactionEntry const* factionEntry, int32 standing) { int32 rank = MIN_REPUTATION_RANK; - if (std::set<FriendshipRepReactionEntry const*> const* friendshipReactions = sDB2Manager.GetFriendshipRepReactions(factionEntry->FriendshipRepID)) + if (DB2Manager::FriendshipRepReactionSet const* friendshipReactions = sDB2Manager.GetFriendshipRepReactions(factionEntry->FriendshipRepID)) rank = ReputationToRankHelper(*friendshipReactions, standing, [](FriendshipRepReactionEntry const* frr) { return frr->ReactionThreshold; }); else rank = ReputationToRankHelper(ReputationRankThresholds, standing, [](int32 threshold) { return threshold; }); @@ -128,7 +128,7 @@ int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const int32 ReputationMgr::GetMinReputation(FactionEntry const* factionEntry) const { - if (std::set<FriendshipRepReactionEntry const*> const* friendshipReactions = sDB2Manager.GetFriendshipRepReactions(factionEntry->FriendshipRepID)) + if (DB2Manager::FriendshipRepReactionSet const* friendshipReactions = sDB2Manager.GetFriendshipRepReactions(factionEntry->FriendshipRepID)) return (*friendshipReactions->begin())->ReactionThreshold; return *ReputationRankThresholds.begin(); @@ -155,7 +155,7 @@ int32 ReputationMgr::GetMaxReputation(FactionEntry const* factionEntry) const return cap; } - if (std::set<FriendshipRepReactionEntry const*> const* friendshipReactions = sDB2Manager.GetFriendshipRepReactions(factionEntry->FriendshipRepID)) + if (DB2Manager::FriendshipRepReactionSet const* friendshipReactions = sDB2Manager.GetFriendshipRepReactions(factionEntry->FriendshipRepID)) return (*friendshipReactions->rbegin())->ReactionThreshold; int32 dataIndex = GetFactionDataIndexForRaceAndClass(factionEntry); @@ -195,7 +195,7 @@ std::string ReputationMgr::GetReputationRankName(FactionEntry const* factionEntr if (!factionEntry->FriendshipRepID) return sObjectMgr->GetTrinityString(ReputationRankStrIndex[GetRank(factionEntry)], _player->GetSession()->GetSessionDbcLocale()); - if (std::set<FriendshipRepReactionEntry const*> const* friendshipReactions = sDB2Manager.GetFriendshipRepReactions(factionEntry->FriendshipRepID)) + if (DB2Manager::FriendshipRepReactionSet const* friendshipReactions = sDB2Manager.GetFriendshipRepReactions(factionEntry->FriendshipRepID)) { auto itr = friendshipReactions->begin(); std::advance(itr, uint32(rank)); |