Skip to content

Commit

Permalink
Unwanted value copies fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberium committed Jan 5, 2024
1 parent 92bec48 commit 0de1bc1
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/game/Loot/LootMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2466,10 +2466,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;
Expand All @@ -2478,10 +2478,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;
Expand Down Expand Up @@ -2514,7 +2514,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;

Expand Down Expand Up @@ -2594,7 +2594,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))
Expand All @@ -2618,7 +2618,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);
}

Expand All @@ -2632,7 +2632,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
{
Expand All @@ -2647,7 +2647,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;

Expand All @@ -2665,7 +2665,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
{
Expand All @@ -2680,7 +2680,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;

Expand Down

0 comments on commit 0de1bc1

Please sign in to comment.