From 2bcbfc0471a764e4dd0aee9ab296c93fc34b6d47 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Fri, 5 Jan 2024 12:18:07 +0100 Subject: [PATCH] Unwanted value copies fixes. --- src/game/Loot/LootMgr.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/game/Loot/LootMgr.cpp b/src/game/Loot/LootMgr.cpp index e572cd7c24b..b37f20d6845 100644 --- a/src/game/Loot/LootMgr.cpp +++ b/src/game/Loot/LootMgr.cpp @@ -2599,10 +2599,10 @@ LootStoreItem const* LootTemplate::LootGroup::Roll(Loot const& loot, Player cons // True if group includes at least 1 quest drop entry bool LootTemplate::LootGroup::HasQuestDrop() const { - for (auto i : ExplicitlyChanced) + for (auto const& i : ExplicitlyChanced) if (i.needs_quest) return true; - for (auto i : EqualChanced) + for (auto const& i : EqualChanced) if (i.needs_quest) return true; return false; @@ -2611,10 +2611,10 @@ bool LootTemplate::LootGroup::HasQuestDrop() const // True if group includes at least 1 quest drop entry for active quests of the player bool LootTemplate::LootGroup::HasQuestDropForPlayer(Player const* player) const { - for (auto i : ExplicitlyChanced) + for (auto const& i : ExplicitlyChanced) if (player->HasQuestForItem(i.itemid)) return true; - for (auto i : EqualChanced) + for (auto const& i : EqualChanced) if (player->HasQuestForItem(i.itemid)) return true; return false; @@ -2647,7 +2647,7 @@ float LootTemplate::LootGroup::RawTotalChance() const { float result = 0; - for (auto i : ExplicitlyChanced) + for (auto const& i : ExplicitlyChanced) if (!i.needs_quest) result += i.chance; @@ -2727,7 +2727,7 @@ void LootTemplate::Process(Loot& loot, Player const* lootOwner, LootStore const& } // Rolling non-grouped items - for (auto Entrie : Entries) + for (auto const& Entrie : Entries) { // Check condition if (Entrie.conditionId && lootOwner && !PlayerOrGroupFulfilsCondition(loot, lootOwner, Entrie.conditionId)) @@ -2751,7 +2751,7 @@ void LootTemplate::Process(Loot& loot, Player const* lootOwner, LootStore const& } // Now processing groups - for (const auto& Group : Groups) + for (auto const& Group : Groups) Group.Process(loot, lootOwner, store, rate); } @@ -2765,7 +2765,7 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con return Groups[groupId - 1].HasQuestDrop(); } - for (auto Entrie : Entries) + for (auto const& Entrie : Entries) { if (Entrie.mincountOrRef < 0) // References { @@ -2780,7 +2780,7 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con } // Now processing groups - for (const auto& Group : Groups) + for (auto const& Group : Groups) if (Group.HasQuestDrop()) return true; @@ -2798,7 +2798,7 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co } // Checking non-grouped entries - for (auto Entrie : Entries) + for (auto const& Entrie : Entries) { if (Entrie.mincountOrRef < 0) // References processing { @@ -2813,7 +2813,7 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co } // Now checking groups - for (const auto& Group : Groups) + for (auto const& Group : Groups) if (Group.HasQuestDropForPlayer(player)) return true;