mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Perf Impro to Deck Editor Loading Issue #1847
This is another extra improvement which avoids setting up card catalog in current editor whenever it is actually **not** needed. To do so, ItemPool now implements and equal method, which reflects to equality of contained items. This is because card pool is set up multiple times whenever the Deck Editor tab is initialised - and the operation of setting up the catalog manager is particularly expensive (let alone useless when it's already done!) Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
This commit is contained in:
@@ -273,4 +273,10 @@ public class ItemPool<T extends InventoryItem> implements Iterable<Entry<T, Inte
|
|||||||
public void clear() {
|
public void clear() {
|
||||||
items.clear();
|
items.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
return (obj instanceof ItemPool) &&
|
||||||
|
(this.items.equals(((ItemPool)obj).items));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -396,6 +396,8 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
|
|||||||
public void resetTables() {
|
public void resetTables() {
|
||||||
// Constructed mode can use all cards, no limitations.
|
// Constructed mode can use all cards, no limitations.
|
||||||
this.sectionMode = DeckSection.Main;
|
this.sectionMode = DeckSection.Main;
|
||||||
|
ItemPool currentPool = this.getCatalogManager().getPool();
|
||||||
|
if (currentPool == null || !currentPool.equals(normalPool))
|
||||||
this.getCatalogManager().setPool(normalPool, true);
|
this.getCatalogManager().setPool(normalPool, true);
|
||||||
this.getDeckManager().setPool(this.controller.getModel().getMain());
|
this.getDeckManager().setPool(this.controller.getModel().getMain());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user