aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Reputation/ReputationMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Reputation/ReputationMgr.cpp')
-rw-r--r--src/server/game/Reputation/ReputationMgr.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp
index fb7cbedf0ce..be7ca6a728f 100644
--- a/src/server/game/Reputation/ReputationMgr.cpp
+++ b/src/server/game/Reputation/ReputationMgr.cpp
@@ -342,21 +342,21 @@ void ReputationMgr::SendState(FactionState const* faction)
WorldPackets::Reputation::SetFactionStanding setFactionStanding;
setFactionStanding.BonusFromAchievementSystem = 0.0f;
- int32 standing = faction->VisualStandingIncrease ? faction->VisualStandingIncrease : faction->Standing;
+ auto getStandingForPacket = [](FactionState const* state)
+ {
+ return state->VisualStandingIncrease ? state->VisualStandingIncrease : state->Standing;
+ };
if (faction)
- setFactionStanding.Faction.emplace_back(int32(faction->ReputationListID), standing);
+ setFactionStanding.Faction.emplace_back(int32(faction->ReputationListID), getStandingForPacket(faction));
- for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
+ for (auto& [reputationIndex, state] : _factions)
{
- if (itr->second.needSend)
+ if (state.needSend)
{
- itr->second.needSend = false;
- if (!faction || itr->second.ReputationListID != faction->ReputationListID)
- {
- standing = itr->second.VisualStandingIncrease ? itr->second.VisualStandingIncrease : itr->second.Standing;
- setFactionStanding.Faction.emplace_back(int32(itr->second.ReputationListID), standing);
- }
+ state.needSend = false;
+ if (!faction || state.ReputationListID != faction->ReputationListID)
+ setFactionStanding.Faction.emplace_back(int32(state.ReputationListID), getStandingForPacket(&state));
}
}