This code is wrong....
static CGrid s_grid1(5, INVENTORY_MAX_NUM/5 / 2);
INVENTORY_MAX_NUM / 5 / 2 = 18...
It should be 9, because inventory pages are 5x9......
static CGrid s_grid1(5, INVENTORY_MAX_NUM/5 / 4); //Where 4 is the number of pages..
This is COMPLETELY wrong..... Because the second, third and fourth for iterate ever the same page
for (i = INVENTORY_MAX_NUM / 4; i < INVENTORY_MAX_NUM; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;
s_grid3.Put(i - INVENTORY_MAX_NUM / 4, 1, item->GetSize());
}
for (i = INVENTORY_MAX_NUM / 4; i < INVENTORY_MAX_NUM; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;
s_grid4.Put(i - INVENTORY_MAX_NUM / 4, 1, item->GetSize());
}
It should be:
for (i = INVENTORY_MAX_NUM / 4; i < INVENTORY_MAX_NUM / 4 * 2; ++i) //GRID 2
{
if (!(item = victim->GetInventoryItem(i)))
continue;
s_grid2.Put(i - INVENTORY_MAX_NUM / 4, 1, item->GetSize());
}
for (i = INVENTORY_MAX_NUM / 4 * 2; i < INVENTORY_MAX_NUM / 4 * 3; ++i) //GRID 3
{
if (!(item = victim->GetInventoryItem(i)))
continue;
s_grid3.Put(i - INVENTORY_MAX_NUM / 4 * 2, 1, item->GetSize());
}
for (i = INVENTORY_MAX_NUM / 4 * 3; i < INVENTORY_MAX_NUM; ++i) // GRID 4
{
if (!(item = victim->GetInventoryItem(i)))
continue;
s_grid4.Put(i - INVENTORY_MAX_NUM / 4 * 3, 1, item->GetSize());
}
And finally there are no implementation in the next source code to count the void spaces for 3° and 4° pages..