Shift group hotkeys to map 1 - 10 instead 0 - 9

Number groups from 1 - 10 replacing group 0 with group 10 for default
hotkey 0.

Differential revision: D4615
Reviewed by: @Langbart
Fixes: #6509

This was SVN commit r26837.
This commit is contained in:
Angen 2022-04-28 17:03:58 +00:00
parent ac60b12045
commit 7765393908
4 changed files with 21 additions and 16 deletions

View file

@ -290,7 +290,6 @@ idleunit = BackSlash ; Select next idle unit
offscreen = Alt ; Include offscreen units in selection
singleselection = "" ; Modifier to select units individually, opposed to per formation.
[hotkey.selection.group.add]
0 = "Shift+0", "Shift+Num0"
1 = "Shift+1", "Shift+Num1"
2 = "Shift+2", "Shift+Num2"
3 = "Shift+3", "Shift+Num3"
@ -300,8 +299,8 @@ singleselection = "" ; Modifier to select units individually, opposed to per for
7 = "Shift+7", "Shift+Num7"
8 = "Shift+8", "Shift+Num8"
9 = "Shift+9", "Shift+Num9"
10 = "Shift+0", "Shift+Num0"
[hotkey.selection.group.save]
0 = "Ctrl+0", "Ctrl+Num0"
1 = "Ctrl+1", "Ctrl+Num1"
2 = "Ctrl+2", "Ctrl+Num2"
3 = "Ctrl+3", "Ctrl+Num3"
@ -311,8 +310,8 @@ singleselection = "" ; Modifier to select units individually, opposed to per for
7 = "Ctrl+7", "Ctrl+Num7"
8 = "Ctrl+8", "Ctrl+Num8"
9 = "Ctrl+9", "Ctrl+Num9"
10 = "Ctrl+0", "Ctrl+Num0"
[hotkey.selection.group.select]
0 = 0, Num0
1 = 1, Num1
2 = 2, Num2
3 = 3, Num3
@ -322,6 +321,7 @@ singleselection = "" ; Modifier to select units individually, opposed to per for
7 = 7, Num7
8 = 8, Num8
9 = 9, Num9
10 = 0, Num0
[hotkey.gamesetup]
mapbrowser.open = "M"

View file

@ -59,10 +59,6 @@
"name": "Single selection",
"desc": "Modifier to select units individually, opposed to per formation."
},
"selection.group.save.0": {
"name": "Set Control Group 0",
"desc": "Save current selection as Control Group 0."
},
"selection.group.save.1": {
"name": "Set Control Group 1",
"desc": "Save current selection as Control Group 1."
@ -99,9 +95,9 @@
"name": "Set Control Group 9",
"desc": "Save current selection as Control Group 9."
},
"selection.group.select.0": {
"name": "Select Control Group 0",
"desc": "Change the current selection to Control Group 0."
"selection.group.save.10": {
"name": "Set Control Group 10",
"desc": "Save current selection as Control Group 10."
},
"selection.group.select.1": {
"name": "Select Control Group 1",
@ -139,9 +135,9 @@
"name": "Select Control Group 9",
"desc": "Change the current selection to Control Group 9."
},
"selection.group.add.0": {
"name": "Add Control Group 0",
"desc": "Add Control Group 0 to the current selection."
"selection.group.select.10": {
"name": "Select Control Group 10",
"desc": "Change the current selection to Control Group 10."
},
"selection.group.add.1": {
"name": "Add Control Group 1",
@ -178,6 +174,10 @@
"selection.group.add.9": {
"name": "Add Control Group 9",
"desc": "Add Control Group 9 to the current selection."
},
"selection.group.add.10": {
"name": "Add Control Group 10",
"desc": "Add Control Group 10 to the current selection."
}
}
}

View file

@ -860,13 +860,13 @@ function handleInputAfterGui(ev)
if (ev.hotkey.indexOf("selection.group.select.") == 0)
{
let sptr = ev.hotkey.split(".");
performGroup("snap", sptr[3]);
performGroup("snap", sptr[3] - 1);
}
}
else
{
let sptr = ev.hotkey.split(".");
performGroup(sptr[2], sptr[3]);
performGroup(sptr[2], sptr[3] - 1);
doublePressTimer = now;
prevHotkey = ev.hotkey;
@ -1607,6 +1607,11 @@ function flushTrainingBatch()
function performGroup(action, groupId)
{
if (g_Groups.groups[groupId] === undefined)
{
warn("Invalid groupId " + groupId);
return;
}
switch (action)
{
case "snap":

View file

@ -751,7 +751,7 @@ function updateGroups()
for (let i in Engine.GetGUIObjectByName("unitGroupPanel").children)
{
Engine.GetGUIObjectByName("unitGroupLabel[" + i + "]").caption = i;
Engine.GetGUIObjectByName("unitGroupLabel[" + i + "]").caption = +i + 1;
let button = Engine.GetGUIObjectByName("unitGroupButton[" + i + "]");
button.hidden = g_Groups.groups[i].getTotalCount() == 0;