Ignore formation selection when clicking an unit icon.

It was deemed unintuitive to select the whole formation when clicking an
icon.

Differential revision: https://code.wildfiregames.com/D4295
Comments by: @alre, @Langbart, @marder, @wowgetoffyourcellphone
This was SVN commit r26075.
This commit is contained in:
Freagarach 2021-12-15 08:00:49 +00:00
parent f1f744702b
commit afc77e20a4

View File

@ -184,7 +184,7 @@ EntitySelection.prototype.makePrimarySelection = function(key)
{
const ents = this.groups.getEntsByKey(key);
this.reset();
this.addList(ents);
this.addList(ents, false, false, false);
};
/**
@ -282,7 +282,7 @@ EntitySelection.prototype.checkRenamedEntities = function()
/**
* Add entities to selection. Play selection sound unless quiet is true
*/
EntitySelection.prototype.addList = function(ents, quiet, force = false)
EntitySelection.prototype.addList = function(ents, quiet, force = false, addFormationMembers = true)
{
// If someone else's player is the sole selected unit, don't allow adding to the selection.
const firstEntState = this.selected.size == 1 && GetEntityState(this.getFirstSelected());
@ -291,7 +291,7 @@ EntitySelection.prototype.addList = function(ents, quiet, force = false)
const added = [];
for (const ent of this.addFormationMembers(ents))
for (const ent of addFormationMembers ? this.addFormationMembers(ents) : ents)
{
if (this.selected.size >= g_MaxSelectionSize)
break;