Skip to content

Commit b31e0b9

Browse files
Joseph GJoseph G
authored andcommitted
Handle errors cause by item overflow gracefully
-It's still possible to get too many clips by buying to 30 held while also holding one in your gun -Now when you load too many clips you get the excess deleted instead of a game crash
1 parent 6c8466a commit b31e0b9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

main/src/org/destinationsol/game/item/ItemContainer.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,13 @@ public void add(SolItem addedItem) {
6969
List<SolItem> group = myGroups.get(i);
7070
SolItem item = group.get(0);
7171
if (item.isSame(addedItem)) {
72-
if (group.size() >= MAX_GROUP_SZ) throw new AssertionError("reached group size limit");
73-
group.add(addedItem);
74-
mySize++;
72+
if ((group.size() < MAX_GROUP_SZ))
73+
{
74+
group.add(addedItem);
75+
mySize++;
76+
}
7577
return;
78+
7679
}
7780
}
7881
if (myGroups.size() >= MAX_GROUP_COUNT) throw new AssertionError("reached group count limit");

0 commit comments

Comments
 (0)