- Do not go through the process of adding items to a card pool if it's already infinite (fixes slowdown when removing a card from the deck in the Constructed deck editor)

This commit is contained in:
Agetian
2018-05-09 18:23:25 +03:00
parent d13201fd47
commit 1e1a16a4f4

View File

@@ -719,6 +719,9 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
*/
@Override
public void addItem(final T item, final int qty) {
if (this.isInfinite()) {
return;
}
this.pool.add(item, qty);
if (this.isUnfiltered()) {
this.model.addItem(item, qty);
@@ -736,6 +739,9 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
*/
@Override
public void addItems(final Iterable<Entry<T, Integer>> itemsToAdd) {
if (this.isInfinite()) {
return;
}
this.pool.addAll(itemsToAdd);
if (this.isUnfiltered()) {
this.model.addItems(itemsToAdd);