From ff50e246c7908b9218afd84886dab4a1f2adbb00 Mon Sep 17 00:00:00 2001 From: pfps Date: Thu, 4 May 2017 01:36:05 +0000 Subject: [PATCH] Fix (sortof) bug with mana abilities that require user input --- .settings/org.eclipse.core.resources.prefs | 2 +- forge-gui/src/main/java/forge/match/input/InputQueue.java | 7 +++++-- .../main/java/forge/match/input/InputSyncronizedBase.java | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs index 370ae2c6983..99f26c0203a 100644 --- a/.settings/org.eclipse.core.resources.prefs +++ b/.settings/org.eclipse.core.resources.prefs @@ -1,2 +1,2 @@ eclipse.preferences.version=1 -encoding/=ISO-8859-1 +encoding/=UTF-8 diff --git a/forge-gui/src/main/java/forge/match/input/InputQueue.java b/forge-gui/src/main/java/forge/match/input/InputQueue.java index 39878ba8af4..bfcd2f0d774 100644 --- a/forge-gui/src/main/java/forge/match/input/InputQueue.java +++ b/forge-gui/src/main/java/forge/match/input/InputQueue.java @@ -50,12 +50,15 @@ public class InputQueue extends Observable { return inputStack.isEmpty() ? null : inputStack.peek(); } + /*pfps sometimes this is being called twice for the same input */ public final void removeInput(final Input inp) { - final Input topMostInput = inputStack.isEmpty() ? null : inputStack.pop(); + final Input topMostInput = inputStack.isEmpty() ? null : inputStack.peek(); if (topMostInput != inp) { System.out.println("Cannot remove input " + inp.getClass().getSimpleName() + " because it's not on top of stack. Stack = " + inputStack ); - } + } else { + inputStack.pop(); + } updateObservers(); } diff --git a/forge-gui/src/main/java/forge/match/input/InputSyncronizedBase.java b/forge-gui/src/main/java/forge/match/input/InputSyncronizedBase.java index 3fa1d9b362a..9ca2f6ce712 100644 --- a/forge-gui/src/main/java/forge/match/input/InputSyncronizedBase.java +++ b/forge-gui/src/main/java/forge/match/input/InputSyncronizedBase.java @@ -54,4 +54,4 @@ public abstract class InputSyncronizedBase extends InputBase implements InputSyn } protected void onStop() { } -} \ No newline at end of file +}