mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Change recursion to iteration. This is a bit more efficient, but also I've observed a stack overflow error with this recursion - so maybe iteration will help, unless there's another underlying logic error (e.g. a cycle).
This commit is contained in:
@@ -81,21 +81,21 @@ public abstract class VCardDisplayArea extends VDisplayArea implements ActivateH
|
||||
|
||||
//support adding card panel and attached panels to display area recursively
|
||||
private void addCardPanelToDisplayArea(CardAreaPanel cardPanel) {
|
||||
List<CardAreaPanel> attachedPanels = cardPanel.getAttachedPanels();
|
||||
if (!attachedPanels.isEmpty()) {
|
||||
for (int i = attachedPanels.size() - 1; i >= 0; i--) {
|
||||
addCardPanelToDisplayArea(attachedPanels.get(i));
|
||||
do {
|
||||
List<CardAreaPanel> attachedPanels = cardPanel.getAttachedPanels();
|
||||
if (!attachedPanels.isEmpty()) {
|
||||
for (int i = attachedPanels.size() - 1; i >= 0; i--) {
|
||||
addCardPanelToDisplayArea(attachedPanels.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isVisible()) { //only set display area for card if area is visible
|
||||
cardPanel.displayArea = this;
|
||||
}
|
||||
add(cardPanel);
|
||||
if (isVisible()) { //only set display area for card if area is visible
|
||||
cardPanel.displayArea = this;
|
||||
}
|
||||
add(cardPanel);
|
||||
|
||||
if (cardPanel.getNextPanelInStack() != null) {
|
||||
addCardPanelToDisplayArea(cardPanel.getNextPanelInStack());
|
||||
}
|
||||
cardPanel = cardPanel.getNextPanelInStack();
|
||||
} while (cardPanel != null);
|
||||
}
|
||||
|
||||
public final void removeCardPanel(final CardAreaPanel fromPanel) {
|
||||
|
||||
Reference in New Issue
Block a user