Fixed signedness warning in cItemGrid.
This commit is contained in:
parent
f404130e8c
commit
dfa81829fe
|
@ -580,11 +580,11 @@ bool cItemGrid::DamageItem(int a_X, int a_Y, short a_Amount)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cItemGrid::GenerateRandomLootWithBooks(const cLootProbab * a_LootProbabs, int a_CountLootProbabs, int a_NumSlots, int a_Seed)
|
void cItemGrid::GenerateRandomLootWithBooks(const cLootProbab * a_LootProbabs, size_t a_CountLootProbabs, int a_NumSlots, int a_Seed)
|
||||||
{
|
{
|
||||||
// Calculate the total weight:
|
// Calculate the total weight:
|
||||||
int TotalProbab = 1;
|
int TotalProbab = 1;
|
||||||
for (int i = 0; i < a_CountLootProbabs; i++)
|
for (size_t i = 0; i < a_CountLootProbabs; i++)
|
||||||
{
|
{
|
||||||
TotalProbab += a_LootProbabs[i].m_Weight;
|
TotalProbab += a_LootProbabs[i].m_Weight;
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ void cItemGrid::GenerateRandomLootWithBooks(const cLootProbab * a_LootProbabs, i
|
||||||
int LootRnd = Rnd % TotalProbab;
|
int LootRnd = Rnd % TotalProbab;
|
||||||
Rnd >>= 8;
|
Rnd >>= 8;
|
||||||
cItem CurrentLoot = cItem(E_ITEM_BOOK, 1, 0); // TODO: enchantment
|
cItem CurrentLoot = cItem(E_ITEM_BOOK, 1, 0); // TODO: enchantment
|
||||||
for (int j = 0; j < a_CountLootProbabs; j++)
|
for (size_t j = 0; j < a_CountLootProbabs; j++)
|
||||||
{
|
{
|
||||||
LootRnd -= a_LootProbabs[i].m_Weight;
|
LootRnd -= a_LootProbabs[i].m_Weight;
|
||||||
if (LootRnd < 0)
|
if (LootRnd < 0)
|
||||||
|
|
|
@ -157,7 +157,7 @@ public:
|
||||||
A total of a_NumSlots are taken by the loot.
|
A total of a_NumSlots are taken by the loot.
|
||||||
Cannot export to Lua due to raw array a_LootProbabs. TODO: Make this exportable / export through ManualBindings.cpp with a Lua table as LootProbabs
|
Cannot export to Lua due to raw array a_LootProbabs. TODO: Make this exportable / export through ManualBindings.cpp with a Lua table as LootProbabs
|
||||||
*/
|
*/
|
||||||
void GenerateRandomLootWithBooks(const cLootProbab * a_LootProbabs, int a_CountLootProbabs, int a_NumSlots, int a_Seed);
|
void GenerateRandomLootWithBooks(const cLootProbab * a_LootProbabs, size_t a_CountLootProbabs, int a_NumSlots, int a_Seed);
|
||||||
|
|
||||||
/// Adds a callback that gets called whenever a slot changes. Must not be called from within the listener callback!
|
/// Adds a callback that gets called whenever a slot changes. Must not be called from within the listener callback!
|
||||||
void AddListener(cListener & a_Listener);
|
void AddListener(cListener & a_Listener);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user