Browse Source

Update to list based lookup

bugfix-slot-update-2
MagicBot 9 months ago
parent
commit
f4ceab41dd
  1. 12
      src/engine/gameManager/BuildingManager.java

12
src/engine/gameManager/BuildingManager.java

@ -53,8 +53,14 @@ public enum BuildingManager { @@ -53,8 +53,14 @@ public enum BuildingManager {
int numOfSlots = _slotLocations.get(building.meshUUID).size();
if (building.hirelings.isEmpty())
return 0;
for (int i = 0; i < numOfSlots; i++) {
if (i > building.hirelings.size())
return i;
if (building.hirelings.get(i) == null)
return i;
}
@ -73,8 +79,14 @@ public enum BuildingManager { @@ -73,8 +79,14 @@ public enum BuildingManager {
int numOfSlots = _slotLocations.get(building.meshUUID).size();
if (building.hirelings.isEmpty())
return numOfSlots - 1;
for (int i = numOfSlots - 1; i >= 0; i--) {
if (i > building.hirelings.size())
return i;
if (building.hirelings.get(i) == null)
return i;
}

Loading…
Cancel
Save