mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
prepared a ground to run AI inputs skipping EDT thread
This commit is contained in:
8
src/main/java/forge/game/ai/AiInput.java
Normal file
8
src/main/java/forge/game/ai/AiInput.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package forge.game.ai;
|
||||
|
||||
import forge.control.input.Input;
|
||||
|
||||
// This interface indicates that the showMessage has to be invoked in a new pooled thread, not EDT.
|
||||
public interface AiInput extends Input {
|
||||
|
||||
}
|
||||
@@ -28,7 +28,7 @@ import forge.control.input.InputBase;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class AiInputCommon extends InputBase {
|
||||
public class AiInputCommon extends InputBase implements AiInput {
|
||||
/** Constant <code>serialVersionUID=-3091338639571662216L</code>. */
|
||||
private static final long serialVersionUID = -3091338639571662216L;
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import forge.FThreads;
|
||||
import forge.control.input.Input;
|
||||
import forge.game.GameState;
|
||||
import forge.game.MatchController;
|
||||
import forge.game.ai.AiInput;
|
||||
import forge.game.phase.PhaseHandler;
|
||||
import forge.game.player.Player;
|
||||
|
||||
@@ -70,7 +71,11 @@ public class InputProxy implements Observer {
|
||||
|
||||
if (nextInput != null) {
|
||||
this.input.set(nextInput);
|
||||
FThreads.invokeInEDT(new Runnable() { @Override public void run() { nextInput.showMessage(); } });
|
||||
Runnable showMessage = new Runnable() { @Override public void run() { nextInput.showMessage(); } };
|
||||
// if( nextInput instanceof AiInput )
|
||||
// FThreads.invokeInNewThread(showMessage, true);
|
||||
// else
|
||||
FThreads.invokeInEDT(showMessage);
|
||||
} else if (!ph.isPlayerPriorityAllowed()) {
|
||||
ph.getPriorityPlayer().getController().passPriority();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user