mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Merge branch 'assorted-fixes' into 'master'
Fixed slowdown when removing a card from the deck in Constructed deck editor with infinite catalog cardpool See merge request core-developers/forge!545
This commit is contained in:
@@ -40,6 +40,7 @@ import javax.swing.event.ListSelectionListener;
|
|||||||
import javax.swing.event.PopupMenuEvent;
|
import javax.swing.event.PopupMenuEvent;
|
||||||
import javax.swing.event.PopupMenuListener;
|
import javax.swing.event.PopupMenuListener;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
@@ -719,6 +720,9 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addItem(final T item, final int qty) {
|
public void addItem(final T item, final int qty) {
|
||||||
|
if (this.isInfinite() && this.model.getOrderedList().contains(item)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.pool.add(item, qty);
|
this.pool.add(item, qty);
|
||||||
if (this.isUnfiltered()) {
|
if (this.isUnfiltered()) {
|
||||||
this.model.addItem(item, qty);
|
this.model.addItem(item, qty);
|
||||||
@@ -736,6 +740,9 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addItems(final Iterable<Entry<T, Integer>> itemsToAdd) {
|
public void addItems(final Iterable<Entry<T, Integer>> itemsToAdd) {
|
||||||
|
if (this.isInfinite() && this.model.getOrderedList().containsAll(Lists.newArrayList(itemsToAdd))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.pool.addAll(itemsToAdd);
|
this.pool.addAll(itemsToAdd);
|
||||||
if (this.isUnfiltered()) {
|
if (this.isUnfiltered()) {
|
||||||
this.model.addItems(itemsToAdd);
|
this.model.addItems(itemsToAdd);
|
||||||
|
|||||||
Reference in New Issue
Block a user