mirror of
https://github.com/correl/mage.git
synced 2024-11-28 11:09:54 +00:00
* Deactivated macro button, becuase it's not working correctly (#2147).
This commit is contained in:
parent
94994dd3ec
commit
400bbba8e1
3 changed files with 92 additions and 76 deletions
|
@ -1440,7 +1440,6 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
|
||||
int c = JComponent.WHEN_IN_FOCUSED_WINDOW;
|
||||
|
||||
|
||||
btnToggleMacro.setContentAreaFilled(false);
|
||||
btnToggleMacro.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
|
||||
btnToggleMacro.setIcon(new ImageIcon(ImageManagerImpl.instance.getToggleRecordMacroButtonImage()));
|
||||
|
@ -1837,9 +1836,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
.addComponent(btnSkipToEndStepBeforeYourTurn)
|
||||
)
|
||||
.addGroup(gl_pnlShortCuts.createSequentialGroup()
|
||||
.addComponent(btnToggleMacro)
|
||||
.addComponent(txtHoldPriority)
|
||||
.addComponent(txtSpellsCast)
|
||||
/* .addComponent(btnToggleMacro)*/
|
||||
.addComponent(btnSwitchHands)
|
||||
.addComponent(btnCancelSkip)
|
||||
.addComponent(btnConcede)
|
||||
|
|
|
@ -87,7 +87,6 @@ public class HumanPlayer extends PlayerImpl {
|
|||
protected static FilterAttackingCreature filterAttack = new FilterAttackingCreature();
|
||||
protected static FilterBlockingCreature filterBlock = new FilterBlockingCreature();
|
||||
protected final Choice replacementEffectChoice;
|
||||
|
||||
private static final Logger logger = Logger.getLogger(HumanPlayer.class);
|
||||
|
||||
protected HashSet<String> autoSelectReplacementEffects = new HashSet<>();
|
||||
|
@ -119,9 +118,26 @@ public class HumanPlayer extends PlayerImpl {
|
|||
|
||||
public HumanPlayer(final HumanPlayer player) {
|
||||
super(player);
|
||||
this.replacementEffectChoice = player.replacementEffectChoice;
|
||||
this.autoSelectReplacementEffects.addAll(autoSelectReplacementEffects);
|
||||
this.currentlyUnpaidMana = player.currentlyUnpaidMana;
|
||||
this.replacementEffectChoice = player.replacementEffectChoice;
|
||||
|
||||
this.triggerAutoOrderAbilityFirst.addAll(player.triggerAutoOrderAbilityFirst);
|
||||
this.triggerAutoOrderAbilityLast.addAll(player.triggerAutoOrderAbilityLast);
|
||||
this.triggerAutoOrderNameFirst.addAll(player.triggerAutoOrderNameFirst);
|
||||
this.triggerAutoOrderNameLast.addAll(player.triggerAutoOrderNameLast);
|
||||
|
||||
this.requestAutoAnswerId.putAll(player.requestAutoAnswerId);
|
||||
this.requestAutoAnswerText.putAll(player.requestAutoAnswerText);
|
||||
|
||||
this.holdingPriority = player.holdingPriority;
|
||||
|
||||
this.actionQueue.addAll(player.actionQueue);
|
||||
this.actionQueueSaved.addAll(player.actionQueueSaved);
|
||||
this.actionIterations = player.actionIterations;
|
||||
this.recordingMacro = player.recordingMacro;
|
||||
this.macroTriggeredSelectionFlag = player.macroTriggeredSelectionFlag;
|
||||
this.activatingMacro = player.activatingMacro;
|
||||
}
|
||||
|
||||
protected boolean isExecutingMacro() {
|
||||
|
@ -134,6 +150,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
if (actionQueue.isEmpty() && actionIterations > 0 && !actionQueueSaved.isEmpty()) {
|
||||
actionQueue = new LinkedList(actionQueueSaved);
|
||||
actionIterations--;
|
||||
// logger.info("MACRO iteration: " + actionIterations);
|
||||
}
|
||||
PlayerResponse action = actionQueue.poll();
|
||||
if (action != null) {
|
||||
|
@ -158,6 +175,11 @@ public class HumanPlayer extends PlayerImpl {
|
|||
protected void waitForResponse(Game game) {
|
||||
if (isExecutingMacro()) {
|
||||
pullResponseFromQueue(game);
|
||||
// logger.info("MACRO pull from queue: " + response.toString());
|
||||
// try {
|
||||
// TimeUnit.MILLISECONDS.sleep(1000);
|
||||
// } catch (InterruptedException e) {
|
||||
// }
|
||||
return;
|
||||
}
|
||||
response.clear();
|
||||
|
@ -166,7 +188,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
synchronized (response) {
|
||||
try {
|
||||
response.wait();
|
||||
logger.debug("Got response from player: " + getId());
|
||||
logger.info("Got response from player: " + response.toString());
|
||||
} catch (InterruptedException ex) {
|
||||
logger.error("Response error for player " + getName() + " gameId: " + game.getId(), ex);
|
||||
} finally {
|
||||
|
@ -174,7 +196,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
}
|
||||
}
|
||||
if (recordingMacro && !macroTriggeredSelectionFlag) {
|
||||
logger.debug("Adding an action " + response);
|
||||
// logger.info("Adding an action " + response);
|
||||
actionQueueSaved.add(new PlayerResponse(response));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.player.human;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -49,18 +48,14 @@ public class PlayerResponse implements Serializable {
|
|||
clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new StringBuilder((responseString == null) ? "null" : responseString)
|
||||
.append(',')
|
||||
.append(responseUUID)
|
||||
.append(',')
|
||||
.append(responseBoolean)
|
||||
.append(',')
|
||||
.append(responseInteger)
|
||||
.append(',')
|
||||
.append(responseManaType)
|
||||
.append(',')
|
||||
.append(responseManaTypePlayerId).toString();
|
||||
return ((responseString == null) ? "null" : responseString)
|
||||
+ ',' + responseUUID
|
||||
+ ',' + responseBoolean
|
||||
+ ',' + responseInteger
|
||||
+ ',' + responseManaType
|
||||
+ ',' + responseManaTypePlayerId;
|
||||
}
|
||||
|
||||
public PlayerResponse(PlayerResponse other) {
|
||||
|
|
Loading…
Reference in a new issue