Index: binaries/data/config/default.cfg =================================================================== --- binaries/data/config/default.cfg +++ binaries/data/config/default.cfg @@ -382,6 +382,7 @@ experiencestatusbar = true ; Show an experience status bar above each selected unit respoptooltipsort = 0 ; Sorting players in the resources and population tooltip by value (0 - no sort, -1 - ascending, 1 - descending) snaptoedgesdistancethreshold = 15 ; On which distance we don't snap to edges +disjointcontrolgroups = "true" ; Whether control groups are disjoint sets or entities can be in multiple control groups at the same time. [gui.session.minimap] blinkduration = 1.7 ; The blink duration while pinging Index: binaries/data/mods/public/gui/options/options.json =================================================================== --- binaries/data/mods/public/gui/options/options.json +++ binaries/data/mods/public/gui/options/options.json @@ -544,6 +544,24 @@ "label": "Diplomacy colors: enemy", "tooltip": "Color of enemies when diplomacy colors are enabled.", "config": "gui.session.diplomacycolors.enemy" + }, + { + "type": "dropdown", + "label": "Control Groups", + "tooltip": "Decide whether units can be part of multiple control groups.", + "config": "gui.session.disjointcontrolgroups", + "list": [ + { + "value": "true", + "label": "Disjoint", + "tooltip": "When adding units to a selection, they are removed from other control groups. Use this choice if you want each control group to refer to a distinct army." + }, + { + "value": "false", + "label": "Overlapping", + "tooltip": "Units can be part of multiple control groups. This can be useful to keep control groups for distinct armies and the entire army simultaneously." + } + ] } ] } Index: binaries/data/mods/public/gui/session/selection.js =================================================================== --- binaries/data/mods/public/gui/session/selection.js +++ binaries/data/mods/public/gui/session/selection.js @@ -474,12 +474,18 @@ this.groups[i] = new EntityGroups(); } +/** + * Add entities to a group. + * @param {string} groupName - The number of the group to add the entities to. + * @param {number[]} ents - The entities to add to the group. + */ EntityGroupsContainer.prototype.addEntities = function(groupName, ents) { - for (let ent of ents) - for (let group of this.groups) - if (ent in group.ents) - group.removeEnt(ent); + if (Engine.ConfigDB_GetValue("user", "gui.session.disjointcontrolgroups") == "true") + for (let ent of ents) + for (let group of this.groups) + if (ent in group.ents) + group.removeEnt(ent); this.groups[groupName].add(ents); };