Fix (sortof) bug with mana abilities that require user input

This commit is contained in:
pfps
2017-05-04 01:36:05 +00:00
parent 67879eb3fe
commit ff50e246c7
3 changed files with 7 additions and 4 deletions

View File

@@ -1,2 +1,2 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
encoding/<project>=ISO-8859-1 encoding/<project>=UTF-8

View File

@@ -50,12 +50,15 @@ public class InputQueue extends Observable {
return inputStack.isEmpty() ? null : inputStack.peek(); return inputStack.isEmpty() ? null : inputStack.peek();
} }
/*pfps sometimes this is being called twice for the same input */
public final void removeInput(final Input inp) { 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) { if (topMostInput != inp) {
System.out.println("Cannot remove input " + inp.getClass().getSimpleName() + " because it's not on top of stack. Stack = " + inputStack ); System.out.println("Cannot remove input " + inp.getClass().getSimpleName() + " because it's not on top of stack. Stack = " + inputStack );
} } else {
inputStack.pop();
}
updateObservers(); updateObservers();
} }