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 ca97309 commit 1ebd794
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 @@ -2473,10 +2473,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 @@ -2485,10 +2485,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 @@ -2521,7 +2521,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 @@ -2601,7 +2601,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 @@ -2625,7 +2625,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 @@ -2639,7 +2639,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 @@ -2654,7 +2654,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 @@ -2672,7 +2672,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 @@ -2687,7 +2687,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 1ebd794

Please sign in to comment.