1
0
forked from 0ad/0ad

Fix grouping of garrisoned units. Patch by mimo. Fixes #1918.

This was SVN commit r13360.
This commit is contained in:
leper 2013-04-18 18:18:24 +00:00
parent 503b481468
commit a362b41029

View File

@ -59,11 +59,12 @@ EntityGroups.prototype.add = function(ents)
continue;
var templateName = entState.template;
// Special handling for garrisoned units
if (templateName && templateName.indexOf("&") != -1)
var key = templateName;
else
var key = GetTemplateData(templateName).selectionGroupName || templateName;
var key = GetTemplateData(templateName).selectionGroupName || templateName;
// Prefix garrisoned unit's selection name with the player they belong to
var index = templateName.indexOf("&");
if (index != -1 && key.indexOf("&") == -1)
key = templateName.slice(0, index+1) + key;
if (this.groups[key])
this.groups[key] += 1;