Prevent repeating shortcuts for abilities

This commit is contained in:
drdev
2013-11-12 01:57:24 +00:00
parent 5df82652b6
commit f11909d6da

View File

@@ -133,11 +133,13 @@ public class PlayerControllerHuman extends PlayerController {
CMessage.SINGLETON_INSTANCE.getInputControl().selectAbility(ab); CMessage.SINGLETON_INSTANCE.getInputControl().selectAbility(ab);
} }
}, enabled); }, enabled);
if (shortcut > 0) {
shortcut++; shortcut++;
if (shortcut > KeyEvent.VK_9) { if (shortcut > KeyEvent.VK_9) {
shortcut = 0; //stop adding shortcuts after 9 shortcut = 0; //stop adding shortcuts after 9
} }
} }
}
if (hasEnabled) { //only show menu if at least one ability can be played if (hasEnabled) { //only show menu if at least one ability can be played
SwingUtilities.invokeLater(new Runnable() { //use invoke later to ensure first ability selected by default SwingUtilities.invokeLater(new Runnable() { //use invoke later to ensure first ability selected by default
public void run() { public void run() {