using kotlin's newfangled 'x in xs.indices' instead of 'x in 0 until xs.size'

This commit is contained in:
minjaesong
2020-10-21 17:42:58 +09:00
parent 2437fed1ea
commit 0c48b9dce8
12 changed files with 25 additions and 25 deletions

View File

@@ -307,7 +307,7 @@ package net.torvald.terrarum.modulebasegame.ui
inventorySortList.sortBy { it.item.name }
// map sortList to item list
for (k in 0 until items.size) {
for (k in items.indices) {
// we have an item
try {
val sortListItem = inventorySortList[k + itemPage * items.size]

View File

@@ -353,7 +353,7 @@ class UIItemInventoryDynamicList(
inventorySortList.sortBy { ItemCodex[it.item]!!.name }
// map sortList to item list
for (k in 0 until items.size) {
for (k in items.indices) {
// we have an item
try {
val sortListItem = inventorySortList[k + itemPage * items.size]
@@ -372,7 +372,7 @@ class UIItemInventoryDynamicList(
}
// set equippedslot number
for (eq in 0 until inventory.itemEquipped.size) {
for (eq in inventory.itemEquipped.indices) {
if (eq < inventory.itemEquipped.size) {
if (inventory.itemEquipped[eq] == items[k].item?.dynamicID) {
items[k].equippedSlot = eq

View File

@@ -118,7 +118,7 @@ class UIItemInventoryEquippedView(
// sort by equip position
// fill the grid from fastest index, make no gap in-between of slots
for (k in 0 until itemGrid.size) {
for (k in itemGrid.indices) {
val item = inventory.itemEquipped[k]
if (item == null) {