|
|
@ -56,15 +56,11 @@ public enum BuildingManager { |
|
|
|
if (building.hirelings.isEmpty()) |
|
|
|
if (building.hirelings.isEmpty()) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < numOfSlots; i++) { |
|
|
|
if (building.hirelings.size() == numOfSlots) |
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
if (i > building.hirelings.size()) |
|
|
|
return building.hirelings.size() + 1; |
|
|
|
return i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (building.hirelings.get(i) == null) |
|
|
|
|
|
|
|
return i; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static int getLastAvailableSlot(Building building) { |
|
|
|
public static int getLastAvailableSlot(Building building) { |
|
|
@ -82,15 +78,10 @@ public enum BuildingManager { |
|
|
|
if (building.hirelings.isEmpty()) |
|
|
|
if (building.hirelings.isEmpty()) |
|
|
|
return numOfSlots - 1; |
|
|
|
return numOfSlots - 1; |
|
|
|
|
|
|
|
|
|
|
|
for (int i = numOfSlots - 1; i >= 0; i--) { |
|
|
|
if (building.hirelings.size() == numOfSlots) |
|
|
|
|
|
|
|
|
|
|
|
if (i > building.hirelings.size()) |
|
|
|
|
|
|
|
return i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (building.hirelings.get(i) == null) |
|
|
|
|
|
|
|
return i; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return numOfSlots - 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static BuildingLocation getSlotLocation(Building building, int slot) { |
|
|
|
public static BuildingLocation getSlotLocation(Building building, int slot) { |
|
|
|