Skip to content

Commit

Permalink
Changed i variable to j
Browse files Browse the repository at this point in the history
The server wasn't going over all the items before.
  • Loading branch information
NiLSPACE committed Oct 16, 2014
1 parent 5ed6d28 commit 07b5ce0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/ItemGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,11 +654,18 @@ void cItemGrid::GenerateRandomLootWithBooks(const cLootProbab * a_LootProbabs, s

for (size_t j = 0; j < a_CountLootProbabs; j++)
{
LootRnd -= a_LootProbabs[i].m_Weight;
LootRnd -= a_LootProbabs[j].m_Weight;
if (LootRnd < 0)
{
CurrentLoot = a_LootProbabs[i].m_Item;
CurrentLoot.m_ItemCount = a_LootProbabs[i].m_MinAmount + (Rnd % (a_LootProbabs[i].m_MaxAmount - a_LootProbabs[i].m_MinAmount));
CurrentLoot = a_LootProbabs[j].m_Item;
if ((a_LootProbabs[j].m_MaxAmount - a_LootProbabs[j].m_MinAmount) > 0)
{
CurrentLoot.m_ItemCount = a_LootProbabs[j].m_MinAmount + (Rnd % (a_LootProbabs[j].m_MaxAmount - a_LootProbabs[j].m_MinAmount));
}
else
{
CurrentLoot.m_ItemCount = a_LootProbabs[j].m_MinAmount;
}
Rnd >>= 8;
break;
}
Expand Down

0 comments on commit 07b5ce0

Please sign in to comment.