aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/DataStores/DB2Stores.cpp4
-rw-r--r--src/server/game/DataStores/DB2Stores.h3
-rw-r--r--src/server/game/Reputation/ReputationMgr.cpp12
3 files changed, 10 insertions, 9 deletions
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp
index 872762d0900..f9bc873bba5 100644
--- a/src/server/game/DataStores/DB2Stores.cpp
+++ b/src/server/game/DataStores/DB2Stores.cpp
@@ -417,7 +417,7 @@ namespace
std::unordered_map<std::pair<uint32 /*level*/, int32 /*expansion*/>, ExpectedStatEntry const*> _expectedStatsByLevel;
std::unordered_map<uint32 /*contentTuningId*/, std::vector<ExpectedStatModEntry const*>> _expectedStatModsByContentTuning;
FactionTeamContainer _factionTeams;
- std::unordered_map<uint32, std::set<FriendshipRepReactionEntry const*>> _friendshipRepReactions;
+ std::unordered_map<uint32, std::set<FriendshipRepReactionEntry const*, DB2Manager::FriendshipRepReactionEntryComparator>> _friendshipRepReactions;
HeirloomItemsContainer _heirlooms;
GlyphBindableSpellsContainer _glyphBindableSpells;
GlyphRequiredSpecsContainer _glyphRequiredSpecs;
@@ -2240,7 +2240,7 @@ std::vector<uint32> const* DB2Manager::GetFactionTeamList(uint32 faction) const
return Trinity::Containers::MapGetValuePtr(_factionTeams, faction);
}
-std::set<FriendshipRepReactionEntry const*> const* DB2Manager::GetFriendshipRepReactions(uint32 friendshipRepID) const
+DB2Manager::FriendshipRepReactionSet const* DB2Manager::GetFriendshipRepReactions(uint32 friendshipRepID) const
{
return Trinity::Containers::MapGetValuePtr(_friendshipRepReactions, friendshipRepID);
}
diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h
index 08cb150e66e..c0d90be4719 100644
--- a/src/server/game/DataStores/DB2Stores.h
+++ b/src/server/game/DataStores/DB2Stores.h
@@ -315,6 +315,7 @@ public:
using HotfixContainer = std::unordered_map<int32, std::vector<HotfixRecord>>;
+ using FriendshipRepReactionSet = std::set<FriendshipRepReactionEntry const*, FriendshipRepReactionEntryComparator>;
using ItemBonusList = std::vector<ItemBonusEntry const*>;
using MapDifficultyContainer = std::unordered_map<uint32, std::unordered_map<uint32, MapDifficultyEntry const*>>;
using MapDifficultyConditionsContainer = std::vector<std::pair<uint32, PlayerConditionEntry const*>>;
@@ -364,7 +365,7 @@ public:
EmotesTextSoundEntry const* GetTextSoundEmoteFor(uint32 emote, uint8 race, uint8 gender, uint8 class_) const;
float EvaluateExpectedStat(ExpectedStatType stat, uint32 level, int32 expansion, uint32 contentTuningId, Classes unitClass) const;
std::vector<uint32> const* GetFactionTeamList(uint32 faction) const;
- std::set<FriendshipRepReactionEntry const*> const* GetFriendshipRepReactions(uint32 friendshipRepID) const;
+ FriendshipRepReactionSet const* GetFriendshipRepReactions(uint32 friendshipRepID) const;
uint32 GetGlobalCurveId(GlobalCurve globalCurveType) const;
std::vector<uint32> const* GetGlyphBindableSpells(uint32 glyphPropertiesId) const;
std::vector<uint32> const* GetGlyphRequiredSpecs(uint32 glyphPropertiesId) const;
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));