made math in GearPage a tiny bit more understandable

This commit is contained in:
NewGarbo 2015-11-04 01:27:33 +00:00
parent ed1e394a84
commit 8033b40011

View File

@ -125,14 +125,14 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
int lines = (int) Math.ceil(size / ((double) itemsPerLine));
for (int ln = 0; ln < lines; ln++)
for (int line = 0; line < lines; line++)
{
int items = ln == lines - 1 ? size - (ln * itemsPerLine) : itemsPerLine;
int start = 9 * ln - items + 14;
int itemInCurLine = line == lines - 1 ? size - (line * itemsPerLine) : itemsPerLine;
int startIndex = 9 * line - itemInCurLine + 14;
for (int item = 0; item < items; item++)
for (int item = 0; item < itemInCurLine; item++)
{
indices[(ln * itemsPerLine) + item] = start + (item * 2);
indices[(line * itemsPerLine) + item] = startIndex + (item * 2);
}
}