mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
removed some (not all) slowdonws in quest card shop when owner of a big collection purchases a fatpack. (there were N redraws of owned card list instead of just one)
This commit is contained in:
@@ -364,7 +364,6 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
||||
if (item instanceof PaperCard) {
|
||||
final PaperCard card = (PaperCard) item;
|
||||
this.getDeckManager().addItem(card, qty);
|
||||
this.getCatalogManager().removeItem(item, qty);
|
||||
this.questData.getCards().buyCard(card, qty, value);
|
||||
|
||||
} else if (item instanceof OpenablePack) {
|
||||
@@ -379,13 +378,13 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
||||
}
|
||||
this.questData.getCards().buyPack(booster, value);
|
||||
final List<PaperCard> newCards = booster.getCards();
|
||||
final List<InventoryItem> newInventory = new LinkedList<InventoryItem>(newCards);
|
||||
|
||||
ItemPool<InventoryItem> newInventory = new ItemPool<InventoryItem>(InventoryItem.class);
|
||||
newInventory.addAllFlat(newCards);
|
||||
getDeckManager().addItems(newInventory);
|
||||
final CardListViewer c = new CardListViewer(booster.getName(),
|
||||
"You have found the following cards inside:", newCards);
|
||||
final CardListViewer c = new CardListViewer(booster.getName(), "You have found the following cards inside:", newCards);
|
||||
c.show();
|
||||
}
|
||||
this.getCatalogManager().removeItem(item, qty);
|
||||
} else if (item instanceof PreconDeck) {
|
||||
final PreconDeck deck = (PreconDeck) item;
|
||||
this.questData.getCards().buyPreconDeck(deck, value);
|
||||
@@ -400,8 +399,8 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
||||
one ? "Deck" : String.format("%d copies of deck", qty),
|
||||
deck.getName(), one ? "was" : "were", one ? "Its" : "Their"),
|
||||
"Thanks for purchasing!", JOptionPane.INFORMATION_MESSAGE);
|
||||
} else return;
|
||||
this.getCatalogManager().removeItem(item, qty);
|
||||
}
|
||||
|
||||
this.creditsLabel.setText("Credits: " + this.questData.getAssets().getCredits());
|
||||
}
|
||||
|
||||
@@ -280,29 +280,9 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel {
|
||||
*/
|
||||
public void addItems(Iterable<Map.Entry<T, Integer>> itemsToAdd) {
|
||||
final int n = this.table.getSelectedRow();
|
||||
for (Map.Entry<T, Integer> item : itemsToAdd) {
|
||||
this.pool.add(item.getKey(), item.getValue());
|
||||
this.pool.addAll(itemsToAdd);
|
||||
if (this.isUnfiltered()) {
|
||||
this.model.addItem(item.getKey(), item.getValue());
|
||||
}
|
||||
}
|
||||
this.updateView(false);
|
||||
this.table.fixSelection(n);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* addItems.
|
||||
*
|
||||
* @param itemsToAdd
|
||||
*/
|
||||
public void addItems(Collection<T> itemsToAdd) {
|
||||
final int n = this.table.getSelectedRow();
|
||||
for (T item : itemsToAdd) {
|
||||
this.pool.add(item, 1);
|
||||
if (this.isUnfiltered()) {
|
||||
this.model.addItem(item, 1);
|
||||
}
|
||||
this.model.addItems(itemsToAdd);
|
||||
}
|
||||
this.updateView(false);
|
||||
this.table.fixSelection(n);
|
||||
|
||||
Reference in New Issue
Block a user